我們即將停用內部部署 API。請參閱我們的內部部署 API 停用文件以取得詳細資訊,並瞭解如何轉移到我們的新一代雲端 API。
We are making changes to the WhatsApp Business Platform pricing model. See Pricing Updates on the WhatsApp Business Platform.
Follow these steps to send an authentication message with a one-time password button to a user who has requested one.
POST
Request to /messages
POST /v1/messages { "to": "recipient_wa_id", "type": "template", "template": { "namespace": "your-namespace", "name": "your-template-name", "language": { "code": "your-language-and-locale-code", "policy": "deterministic" }, "components": [ { "type": "body", "parameters": [ { "type": "text", "text": "user-otp-code" } ] }, { "type": "button", "sub_type": "url", "index": 0, "parameters": [ { "type": "text", "text": "user-otp-code" } ] } ] } }
text
property (parameters.text
) of both objects in the components
array.A successful response includes a messages
object with an id
.
{ "messages": [{ "id": "gBEGkYiEB1VXAglK1ZEqA1YKPrU" }] }
An unsuccessful response contains an error object with an error string, error code and other information.
If a template is sent to an account that is incapable of receiving the template, the 1026 (ReceiverIncapable)
error will be sent in the error object to the configured Webhook server.
See Error and Status Codes for more information on errors.
Attempting to send legacy authentication templates (templates without one-time password buttons) will return error code 1009
if variable values exceed 15 characters or contain links or emojis, or the template body component contains a link. Instead, create and use an authentication template that has a one-time password button.