Skip to content
Get started
Esc
Record consent

Contacts

POST /v1/contacts/{phone}/consent

WhatsApp only

The customer agreed to receive WhatsApp messages, and a template to their number passes the check. Record consent only when the customer really gave it.

Path parameters

phone string required
The customer's number in E.164, with or without the +.

Errors

CodeHTTPWhat it means
invalid_phone422Give the number in international format, for example +77011234567.

Any request can also get the codes on Errors, such as unauthenticated and rate_limited.

Code language
// npm install @airboxhq/api
// AIRBOX_API_KEY=YOUR_API_KEY node consent_grant.mjs
import { Airbox } from "@airboxhq/api";

const client = new Airbox(process.env.AIRBOX_API_KEY);

const { data, error } = await client.contacts.grantConsent("+77011234567");

if (error) {
  throw new Error(`${error.code}: ${error.message} (${error.requestId})`);
}

console.log(data);
Response 201
{
    "phone": "+77011234567",
    "contact_id": "0199c5e2-1f0a-7a42-8d1e-5b7c9a2e4f10",
    "channel": "whatsapp",
    "granted": true,
    "recorded_at": "2026-10-09T09:30:00+00:00"
}