## Overview

The **API channel** is a first-class inbox. Any module of the platform reaches it the same way it
reaches WhatsApp or the web widget: it creates a message on a conversation. That message is then
POSTed — signed — to your inbox **webhook URL**. Because every message payload carries the full
`content_type` **and** `content_attributes`, structured content (interactive buttons, payment CTAs,
catalog cards, calendar events and reactions) reaches your integration natively — you render it.

Everything here is **additive and backward-compatible**: existing integrations keep working and can
ignore any field they don't recognize. There are no new mandatory fields.

## Prerequisites

- An API inbox with a configured **webhook URL**.
- The inbox **secret** to verify the webhook signature (and optionally `hmac_token` for inbound HMAC).
- An **access token** for the REST API when you send data back.

## Step by step

1. Create an API inbox and set its webhook URL.
2. Receive events at that URL and verify the signature with the inbox secret.
3. Read `content_type` + `content_attributes` on each message payload to render rich content.
4. Send inbound messages, delivery receipts and reactions back through the REST API.
5. (Optional) Restrict which events you receive with `webhook_subscriptions`.

### Outbound content types (what the webhook delivers)

Each `message_created` / `message_updated` payload includes `content_type`, `content`,
`content_attributes` and `attachments`. Beyond plain `text`, the API inbox may deliver:

- **`input_select`** — interactive options in `content_attributes.items` (`[{title, value}]`). When a
  channel can't render options, the platform also appends a numbered menu to `content`.
- **`content_attributes.payment_interactive`** — a pay action: `{ body, buttons: [{ type: "cta_url",
  text, url } | { type: "cta_copy", text, code }] }`. The full charge (amount, PIX code, boleto,
  links) also arrives as `content_attributes.payment_charge` on the summary message.
- **`content_attributes.catalog_product`** — a product card: `{ mode: "single" | "list", products:
  [{ id, name, price, currency, image_url, ... }] }`.
- **`content_attributes.calendar_event`** — a booking confirmation or reminder: `{ id, title,
  starts_at, ends_at, location, meet_url, kind: "confirmation" | "reminder" }` (ISO-8601 times).
- **`content_attributes.reactions`** — an array of `{ emoji, sender_jid }`. The operator is `me`; a
  contact is stored under its own identifier. Reactions ride the **`message_updated`** event.
- **Templates** — the sent template metadata rides `additional_attributes.template_params`
  (`{ name, language, category, processed_params }`).
- **Media, location, contacts, stickers** — delivered as real `attachments` (plus
  `content_attributes.media_kind` for stickers).

### Inbound (what you send back)

- **Incoming message** — `POST /api/v1/accounts/{account_id}/conversations/{conversation_id}/messages`
  with `message_type: "incoming"`. It accepts `content`, `content_type`, `content_attributes` and
  `attachments`, so an interactive reply is symmetric with the outbound contract.
- **Delivery receipts** — `PUT/PATCH .../messages/{id}` (API inboxes only) with `status` of
  `sent` / `delivered` / `read` / `failed` (and an optional `external_error`). This flips the
  message status, which is relayed via `message_updated`.
- **Reactions** — `POST .../messages/{id}/react` with `emoji` (an empty emoji removes it). Pass
  `by=contact` to record the **contact's** reaction (the default records the operator's). No provider
  is contacted for an API inbox — the reaction is persisted and relayed via `message_updated`.

### Campaigns

One-off campaigns can target an API inbox. Each audience contact receives a real conversation and an
outgoing message, which rides your webhook exactly like any other outbound message.

### The contact side (Client API and widget)

The webhook above is your integration's side and receives the full `content_attributes`. The
**contact's** side — the public Client API (`/public/api/v1/inboxes/...`), the website widget's API and
socket, and the message event the widget hands the page it is installed on — receives a **closed list**:

- in `content_attributes`: `items`, `submitted_values`, `submitted_email`, `button_label`,
  `display_type`, `in_reply_to` and `deleted`, as they are;
- the cards the platform sends to the contact, each with only the fields the contact sees or uses:

| Key | What the contact receives | What stays in the webhook only |
|---|---|---|
| `payment_charge` | status, amount, currency, subtotal, discount and its reason, payment method, test notice, payment link, PIX copy-and-paste and QR, boleto and digitable line, due date, line items, installments, late fine, interest and early-payment discount, payment date and refunded amount | the charge id and the store's checkout settings (return URLs, `auto_return`, postal delivery) |
| `payment_interactive` and `cta_buttons` | title, text and buttons (`cta_url` with `url`, `cta_copy` with `code`) | — |
| `payment_installment_plan` | status, payment method, test notice, total, currency, installments paid and amount paid, number of installments, next due date, payment book state and how to pay the next installment | the plan id, the charge id and the payment book's internal diagnostic |
| `contract_signature` | title, status, signature level, expiry, the contact's own signing link and the verification page | the contract id and the signer id |
| `commerce_event` | stage, amount, currency, payment method, checkout and payment links, PIX, boleto and expiry | the event id and the source integration |
| `catalog_product` | name, kind, availability, chosen option, price, former price, currency, image and send mode | the product and option ids, the SKU, the operator's button choice and the commercial validation |
| `calendar_event` | title, start and end, place, meeting link, manage link, notice kind and pending-link notice | the appointment id |
| `distribution_card` | launch name, group number and name, invite link and the contact's own state | the launch and group ids |
| `reactions` | emoji and author (`me` for the business, or the contact's own identifier) | — |
| `location` and `contact` | forwarded location and contact card | — |
| `link_preview` and `is_forwarded` | no link preview, forwarded mark | — |

- in each attachment: the fields of the public attachment documented in the API reference (URLs, type,
  size, dimensions, media state and transcription), without `account_id`.

Internal data never reaches the contact: follow-up and automation references, the `external_error` of
the delivery to your webhook, the original text before automatic translation, the delete trail and each
provider's send instructions. The API reference (the `public_message_content_attributes` resource)
documents every field. Need an internal id, for example to reconcile a charge? Use the data the webhook
delivers.

## Settings & options

- **`webhook_subscriptions`** — an optional array on the API channel's `additional_attributes`
  (update the inbox via the API with `channel[additional_attributes][webhook_subscriptions]`). When set, only
  those events are delivered; when absent or empty, **all** events are delivered (the default). Event
  names must be valid platform events (e.g. `message_created`, `message_updated`,
  `conversation_created`, `conversation_status_changed`, `conversation_typing_on`).
- **`hmac_mandatory`** — reject inbound requests that can't be HMAC-verified.

## Use cases

- Bridge the inbox into a custom app that renders payment CTAs, catalog cards and calendar bookings.
- Relay a contact's reaction from your own client back onto the message.
- Mirror booking confirmations and reminders into the customer's channel of record.

## Tips, limits & best practices

- Always verify the webhook signature before acting on a payload.
- Deduplicate by the delivery id / event; expect retries.
- Prefer `content_attributes` for structured rendering; `content` is the plain-text fallback.
- Subscribe only to the events you use to reduce noise.

## Troubleshooting

- **No events arriving**: confirm the webhook URL is set and, if you configured
  `webhook_subscriptions`, that the event you expect is in the list.
- **`422` on subscriptions**: the list contains an unknown event name — remove it.
- **Reaction not attributed to the contact**: pass `by=contact` on the react call.

## See also

- [REST API, tokens and webhooks](/hc/ajuda/articles/api-developers-rest-tokens-webhooks-en)
- [Per-module events](/hc/ajuda/articles/api-developers-eventos-por-modulo-en)
- [API reference (Swagger / OpenAPI)](/hc/ajuda/articles/api-developers-swagger-reference-en)