Sign inGet Started

Create a WhatsApp suppression

POST
/v1/whatsapp/suppressions
// Omit waba to block the address for the whole workspace, whichever account
// sends. With it, your other accounts keep reaching them, and the same
// address for two accounts is two records.
const suppression = await bird.whatsapp.suppressions.add({
  address: "+15550001234",
  waba: "102290129340398",
});
console.log(suppression.id, suppression.applies_to);
Réponse200
{
  "id": "was_01krdgeqcxet5s7t44vh8rt9mg",
  "address": "+5511977670804",
  "waba": null,
  "reason": "manual",
  "origin": "user",
  "applies_to": "all",
  "source_whatsapp_id": "wam_01krdgeqcxet5s7t44vh8rt9mg",
  "ended_reason": "api_key"
}

Stops messages to a WhatsApp address, with reason manual, blocking every message category. Set waba to stop the address for one business account, or omit it to stop the address for every account in the workspace. The account must be one of yours; another workspace's account returns 404.

Adding is idempotent. A 201 means a new suppression was recorded, and a 200 means a manual one for that address and scope was already in place and is returned with last_asserted_at moved to this call, nothing else changed. The same address stopped for one account and for the whole workspace is two records.

Corps de la requête

address
string
obligatoire

The WhatsApp address to stop messaging. For a phone number, supply canonical E.164 with a leading plus sign, such as +5511977670804. A value that is not a valid phone number or business-scoped user ID returns 422.

waba
string

The WhatsApp Business Account to stop, identified by its WhatsApp-issued account ID or by the waa_ ID Bird gives it. Either form resolves to the same account, and the suppression stores and returns the WhatsApp-issued one. Omit it to stop the address for the whole workspace, whichever account sends. An account that is not one of yours returns 404 on a single create, and its row reports error in a bulk create.

Contenu de la réponse

id
string
obligatoire

Unique identifier for the suppression record.

address
string
obligatoire

The suppressed WhatsApp address. For a phone number this is canonical E.164 with a leading plus sign, such as +5511977670804.

waba
nullable string
obligatoire

The WhatsApp Business Account this stops, identified by its WhatsApp-issued account ID. Null when it stops the address for every account in the workspace, whichever one sends.

reason
string
obligatoire

Why the address cannot be messaged:

  • manual: Your workspace added the suppression through the API or the dashboard, and can end it.

Possible values (may grow over time): manual

origin
string
obligatoire

How the suppression came to exist:

  • api_key: an API call.
  • user: someone acting in the dashboard.

Kept beside the reason because one reason can arrive by more than one route.

Possible values (may grow over time): api_key, user

applies_to
string
obligatoire

Message categories blocked for this address. all blocks every category, including authentication and transactional messages, and is the only value in use. Treat unrecognized values as blocking every category.

Possible values (may grow over time): all

blocking
boolean
obligatoire

Whether this is stopping messages right now. Always true in a list, which carries only the suppressions in force; false when you fetch one by ID that has since ended, which is also when ended_at is set.

source_whatsapp_id
nullable string
obligatoire

The WhatsApp message a suppression was opened from. Null for a manual suppression, and Bird records no other kind today, so this is null on every record.

effective_at
string
obligatoire

When the suppression took effect. For one added through the API or the dashboard this is when it was added, so it matches created_at. This is what orders the list.

ended_at
nullable string
obligatoire

When this stopped applying. Null while it is still stopping messages.

ended_reason
nullable string
obligatoire

What ended it:

  • api_key: an API call.
  • user: someone acting in the dashboard.

Null while the suppression is still stopping messages.

Possible values (may grow over time): api_key, user

ended_effective_at
nullable string
obligatoire

When the end took effect. For one ended through the API or the dashboard this matches ended_at. Null while it is still stopping messages.

created_at
string
obligatoire

When we recorded it.

last_asserted_at
string
obligatoire

When we last recorded this suppression being stated. Later than created_at when your workspace added it again while it was already in force; a repeat adds no new record.

Poursuivez avec la documentation, les guides et les exemples sur ce sujet.