Opt-In-and-Outs

Note:

As of June 30th, 2022, the Sinch WhatsApp Business Messaging API does not check whether recipients have opted in before sending messages. It is the user's responsibility to ensure that the recipient has opted in before sending. The endpoints still function, but will not be used to allow or prevent message delivery. For more information on the opt-in and opt-out requirements for WhatsApp messages, see the WhatsApp Business Policy.

All Business initiated conversations via the Sinch WhatsApp Business API should start with an “Opt-In” by the user. This can be collected through any third party channel. For example in an SMS message, In-Line with a Web Form, in an Email, or even via a deep-link in print media.

You can record a opt-in by the API call described below.

Businesses should also provide a method by which customers may opt-out of receiving future messages from your organization. The opt-out-endpoint can be used for this.

Note

If a customer initiates contact with a WhatsApp Business, this will constitute as a temporary, 24-hour opt-in.

For more information on the opt-in and opt-out requirements for WhatsApp messages, see the WhatsApp Business Policy.

Opt-In endpoint

You can Opt-in numbers using the API. Opting in already opted in numbers will be ignored but not rejected. To remove previously opted in number use DELETE Request.

Request

POST whatsapp/v1/{bot-id}/provision/optin

JSON object parameters:

Name Description JSON Type Default Constraints Required
numbers List of MSISDNs String array N/A 1 to 20 elements Yes

Sample

Copy
Copied
{
  "numbers": ["46732001122", "46732002244"]
}

Responses

200 OK

The response body is a JSON object with the following parameters:

Name Description JSON Type
optInNumbers List of successfully opted in numbers Array[Object]
failedToOptInNumbers List of not opted in numbers Array[Object]

Success Opt In

Name Description JSON Type
msisdn Msisdn String
waId WhatsApp account ID String

Failed Opt In

Name Description JSON Type
msisdn Msisdn String
rejectionReason Rejection reason String
Copy
Copied
{
    "optInNumbers": [
        {
            "msisdn": "+46732001122",
            "waId": "46732001122"
        }
    ],
    "failedToOptInNumbers": [
        {
            "msisdn": "+46732002244",
            "rejectionReason": "Capability check failed for msisdn +46732002244, due to status: invalid"
        }
    ]
}

400 Bad Request

There was an error with your request. The body is a JSON object described here

401 Unauthorized

There was an authentication error with your request. Either you're using incorrect credentials or you're attempting to authenticate in a region where your bot doesn't reside. The body is a JSON object described here

Opt-Out endpoint

You can Opt-out numbers using the API.

Request

DELETE whatsapp/v1/{bot-id}/provision/optin

JSON object parameters:

Name Description JSON Type Default Constraints Required
numbers List of MSISDNs String array N/A 1 to 20 elements Yes

Sample

Copy
Copied
{
  "numbers": ["46732001122", "46732002244"]
}

Responses

200 OK

Empty response body

400 Bad Request

There was an error with your request. The body is a JSON object described here

401 Unauthorized

There was an authentication error with your request. Either you're using incorrect credentials or you're attempting to authenticate in a region where your bot doesn't reside. The body is a JSON object described here

Was this page helpful?