Logotipo Hedhog

Get Hedhog updates in your inbox

New releases, fresh recipes, and breaking changes — no spam.

sac Submodule

whatsapp-sources

WhatsApp numbers that open tickets, across the Meta Cloud API and the Evolution API, several per integration profile.

Source path: libraries/sac/src/inbound

Module file: inbound.module.ts

Introduction

A source binds `(integration profile, number)` to a SAC channel. `external_id` holds the `phone_number_id` on the Meta Cloud API, or the instance name on the Evolution API — whichever the webhook reports — and it is unique only within a profile, because two Evolution servers may each have an instance called "support".

The channel must be of kind `whatsapp`, and the API refuses anything else with an explicit error: the channel kind is what routes the agent reply back over WhatsApp, and pointing at an e-mail channel would send the reply by e-mail to a requester who has none.

Receiving itself is not owned here. Both providers deliver into the generic public webhook of the core (`/webhook/:uuid`) through protocol adapters in the `whatsapp` library, which normalize the two very different payload formats into one model and publish the message on the outbox. SAC subscribes to that event, so it never talks to a provider directly.

HTTP Endpoints

5 endpoints

Paginated list of numbers, with provider and channel.

Query
page, pageSize, search

Bind a number to a support channel. A repeated number on the same profile returns 409.

Body

FieldTypeRequiredNotes
channel_idintyesMust be a channel of kind whatsapp
integration_profile_idintyeswhatsapp-official or evolution-api
external_idstringyesphone_number_id (Meta) or instance name (Evolution)
e164stringnoDisplay only
labelstringno

Update the binding.

Params
id (int)

Stop opening tickets from this number. Existing tickets are kept.

Params
id (int)

Provision (idempotently) the public webhook URL to paste into the Meta or Evolution console. Lives in the whatsapp library; admin-sac is granted so the setup can be finished on one screen.

Params
integrationProfileId (int)