← Blog

·

Kiwify + official WhatsApp API: sales notifications and recovery

Updated on November 10, 2026

To send WhatsApp messages from Kiwify through the official API, you register a webhook under Apps > Webhooks, receive the events (purchase approved, Pix generated, boleto generated, abandoned cart, subscription late) on your server and, for each one, send a Meta-approved template to the buyer’s phone. Kiwify signs every webhook with HMAC-SHA1, and the sales API returns the customer’s phone in international format. Purchase updates tend to be utility (R$ 0.0350 per delivered message in Brazil); abandoned cart is marketing (R$ 0.3217) and requires marketing opt-in.

Kiwify is a Brazilian platform for selling digital products (online courses, memberships, ebooks). Pix is Brazil’s instant payment system and a boleto is a bank payment slip that can take a few days to clear. This guide covers the technical side: events, validation, code and template category. The messaging strategy for course creators is in WhatsApp for online course creators.

What Kiwify already does on WhatsApp (and what is left to you)

Before you build, check what the platform offers out of the box, according to its help center:

  • Pix confirmation: Kiwify says it sends a confirmation by email and WhatsApp when a Pix payment is approved (how Pix works).
  • Sales Recovery Agent: an AI agent that talks over WhatsApp to people who abandoned the cart, didn’t pay the Pix or had a card declined. Kiwify says it needs no number of your own and no external tool, and you enable it under Produtos > [product] > Configurações (how to enable).
  • Third-party integrations: the help center’s integrations category lists WhatsApp tools, Zapier, email tools and member areas (integrations).

What these features don’t do is send messages from your number, with your templates, in your voice and tied to your CRM or member area. For that, you connect Kiwify’s webhook to the official WhatsApp API. If you are new to the API, start with the official WhatsApp API guide.

How Kiwify webhooks work

You set them up in the dashboard under Apps > Webhooks > Criar Webhook, choosing the product and the events (help center). You can also create and edit webhooks through the public API (Create webhook).

Each event arrives as a POST with a JSON body. The trigger you tick in the dashboard and the value in the webhook_event_type field have different names, which trips people up when coding (Receive and validate webhooks):

Dashboard triggerwebhook_event_typeorder_statusWhatsApp messageLikely category
compra_aprovadaorder_approvedpaidAccess granted, purchase detailsUtility
pix_geradopix_createdwaiting_paymentPix awaiting paymentUtility, no promotional tone
boleto_geradobillet_createdwaiting_paymentBoleto issued, amount and due dateUtility, no promotional tone
compra_recusadaorder_rejectedrefusedPayment declined, how to retryUtility, if purely informational
carrinho_abandonadonot sentn/aCheckout reminderMarketing
subscription_latesubscription_latelatest order statusLate subscription paymentUtility
subscription_renewedsubscription_renewedlatest order statusRenewal confirmedUtility
compra_reembolsadaorder_refundedrefundedRefund confirmationUtility

The abandoned cart event has its own format: it carries cart data and has neither webhook_event_type nor order_status, so your code must handle it separately. To see the exact fields for each event in your account, use Testar Webhook (sends fictitious data) and Ver logs in the dashboard.

Three delivery rules shape the service design:

  • Return 2xx within 40 seconds. Otherwise Kiwify treats it as a failure and retries a few times at increasing intervals, from 1 up to 10 minutes (you can also resend manually under Ver logs).
  • The same event can arrive more than once. Make processing idempotent with the key order_id + webhook_event_type.
  • There is no sandbox. The public API always works with real data; use the test button to test receiving.

Return 200 quickly and send the WhatsApp message from a queue. The full queue, retry and idempotency pattern is in WhatsApp API integration architecture.

Want to try it while you read? Create a Vectalk account and send your first message through the official API. Create free account →

Validate the webhook signature

Kiwify appends a signature query parameter to your URL: a hex HMAC-SHA1 computed over the raw body using the webhook’s token as the key. The token itself is never sent. If the webhook has no token, the signature uses an empty key and proves nothing, so always set a long random token.

The docs stress two things: compute the HMAC before parsing the JSON (re-serializing changes key order and breaks the signature) and compare in constant time. The signature has no timestamp, so it doesn’t stop replays; idempotency on order_id handles that in practice. The same applies to WhatsApp’s own webhook: see WhatsApp webhook signature validation.

Node.js example: from event to template

The flow below validates the signature, returns 200, looks up the sale in the Kiwify API to get the phone number and sends the matching template. The lookup uses GET /v1/sales/{id} on https://public-api.kiwify.com, which returns customer.mobile as +5511... (Get sale). You create the API key under Apps > API > Criar API Key, and calls carry the OAuth token plus the x-kiwify-account-id header (API overview).

const crypto = require('crypto');
const express = require('express');

const app = express();
const KIWIFY_TOKEN = process.env.KIWIFY_WEBHOOK_TOKEN;
const processed = new Set(); // in production: a table with a unique index

const TEMPLATES = {
  order_approved: 'kiwify_access_granted',
  pix_created: 'kiwify_pix_pending',
  billet_created: 'kiwify_boleto_issued',
  subscription_late: 'kiwify_subscription_late',
};

app.post('/kiwify', express.raw({ type: 'application/json' }), (req, res) => {
  const received = String(req.query.signature || '');
  const expected = crypto.createHmac('sha1', KIWIFY_TOKEN).update(req.body).digest('hex');
  const valid = received.length === expected.length &&
    crypto.timingSafeEqual(Buffer.from(received), Buffer.from(expected));
  if (!valid) return res.status(401).end();

  const event = JSON.parse(req.body.toString('utf8'));
  res.status(200).end(); // reply before any external call

  const key = `${event.order_id}:${event.webhook_event_type}`;
  if (!TEMPLATES[event.webhook_event_type] || processed.has(key)) return;
  processed.add(key);
  enqueue(event); // queue (BullMQ, SQS, a jobs table...) that calls handle(event)
});

async function handle(event) {
  const sale = await fetch(`https://public-api.kiwify.com/v1/sales/${event.order_id}`, {
    headers: {
      Authorization: `Bearer ${process.env.KIWIFY_OAUTH_TOKEN}`,
      'x-kiwify-account-id': process.env.KIWIFY_ACCOUNT_ID,
    },
  }).then(r => r.json());

  const to = (sale.customer?.mobile || '').replace(/\D/g, ''); // +5511... -> 5511...
  if (!to) return;

  await fetch('https://apis.vectalk.com.br/api/messages', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.VECTALK_TOKEN}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      messaging_product: 'whatsapp',
      to,
      type: 'template',
      template: {
        name: TEMPLATES[event.webhook_event_type],
        language: { code: 'pt_BR' },
        components: [{
          type: 'body',
          parameters: [
            { type: 'text', text: sale.customer.name.split(' ')[0] },
            { type: 'text', text: sale.product.name },
          ],
        }],
      },
    }),
  });
}

Two details that save headaches:

  • Affiliates. Kiwify’s help center says buyer data (name, email, phone) may not reach the affiliate unless the producer grants access. If the webhook belongs to an affiliate, handle a missing phone without breaking the flow.
  • Abandoned cart. Since the payload is different, write a separate handler. And only send if the contact has a recorded marketing opt-in.

If you’d rather not maintain code, the same flow runs in n8n with a Webhook node, a Code node for the HMAC and an HTTP Request node for sending. See the n8n + WhatsApp Business API guide.

Templates for each event

Meta decides the category from the content, not the intent. Utility must be non-promotional and specific to a user’s transaction; any incentive makes it marketing (template categorization). Examples that follow that rule (shown in English; for Brazilian buyers you would write them in Portuguese):

EventTemplate textCategory
Purchase approved“Hi {{1}}! Your purchase of {{2}} was approved. Your access was sent to your email. If you can’t find it, reply to this message.”Utility
Pix generated“{{1}}, the Pix for {{2}} was generated and is awaiting payment. Once paid, access is released automatically.”Utility
Boleto generated“{{1}}, the boleto for {{2}} was issued. As soon as the payment clears, access is released.”Utility
Subscription late“{{1}}, we couldn’t find the payment for your {{2}} subscription. To keep access, update your payment method.”Utility
Abandoned cart“{{1}}, you started signing up for {{2}}. Need help finishing?”Marketing

Reminders with discounts, scarcity or “last chance” are marketing, even when the order exists. The article on recovering Pix, boleto and abandoned carts covers timing and what Meta treats as retargeting.

Don’t use WhatsApp to collect chargebacks or third-party debt. The Business Messaging Policy prohibits third-party debt collection; a payment reminder for your own customer is utility.

Cost per sale

For recipients in Brazil, Meta’s rates since October 1, 2026 are R$ 0.0350 per delivered utility template and R$ 0.3217 per marketing template (pricing). A flow with “Pix generated” plus “purchase approved” costs R$ 0.07 per Pix sale. A thousand cart reminders cost R$ 321.70.

Two October 2026 changes affect the bill:

  • Utility templates sent inside the customer service window are now charged. If the student replied and you send the access template right after, it is billed.
  • Each number gets 1,000 free service messages per month; from the 1,001st on, they are charged. The allowance doesn’t cover utility.

Model your volume with the WhatsApp API pricing calculator. If you also sell on Hotmart, the equivalent flow is in Hotmart + official WhatsApp.

How to do it with Vectalk

Vectalk is a proxy for Meta’s official Cloud API. Your service (or n8n) receives the Kiwify webhook and calls POST https://apis.vectalk.com.br/api/messages with the same template JSON Meta uses (send template). Delivery statuses and student replies arrive in Meta’s webhook format (webhooks). You can create templates in the dashboard, using the Template Library, or through the API.

Billing is prepaid: each delivered message is deducted from your balance, with no card registered at Meta. With coexistence, the number can stay in the WhatsApp Business app for human support. Vectalk has no native inbox, AI or bulk sending: support and message sequences live in your system or in tools connected to the API. Create your account at apps.vectalk.com.br/register.

Frequently asked questions

Does Kiwify have a native integration with the official WhatsApp API using my number?

We found no native integration in Kiwify’s help center for sending through the Cloud API from the producer’s own number. The native WhatsApp features (Pix confirmation and the Recovery Agent) belong to Kiwify itself. To use your number and your templates, you connect through the webhook.

Which event should trigger the Pix reminder?

The pix_gerado trigger, which arrives with webhook_event_type: pix_created and order_status: waiting_payment. Schedule the reminder in your queue and, before sending, check that the sale hasn’t been paid (compra_aprovada already arrived, or the sale is paid in the API).

How do I avoid duplicate messages when Kiwify retries a webhook?

Store the key order_id + webhook_event_type with a unique index before queuing the send. If the key exists, skip it. Kiwify’s own docs recommend this combination.

Can I send the abandoned cart message to everyone?

No. Abandoned cart is marketing for Meta and requires the person to have agreed to receive offers from your business. Record the opt-in at checkout or lead capture and honor opt-out requests.


Official sources consulted on November 10, 2026: Kiwify: how webhooks work, Kiwify: receive and validate webhooks, Kiwify: create webhook, Kiwify: get sale, Kiwify: API overview, Kiwify: Sales Recovery Agent, Kiwify: how Pix works, Meta: template categorization, Meta: pricing, WhatsApp Business Messaging Policy, Vectalk: send template, Vectalk: webhooks.

Put your business on the official WhatsApp

Create your account, connect your number to the official API (you can keep the app with coexistence) and start serving customers and sending messages.