Panduan pembalasan.id
Whats App

Send a WhatsApp Template

POST
/api/v1/accounts/{account_id}/whatsapp/send_template

Kirim template WhatsApp yang sudah di-approve Meta ke SATU nomor, langsung via WhatsApp Cloud API. Mendukung SEMUA jenis template & komponen — termasuk header media dan tombol (mis. tombol OTP copy-code / one-tap).

Backend mengambil kredensial WABA (phone_number_id + token) dari inbox_id, meneruskan components (format Meta persis) ke Graph API, lalu mengembalikan respons Meta apa adanya. Tidak membuat percakapan di inbox.

Kapan pakai ini vs mengirim template_params di percakapan? Alur template_params (Create New Message) hanya mengisi variabel BODY, sehingga template ber-tombol (OTP/AUTHENTICATION) GAGAL dengan error Meta (#131008) Required parameter is missing. Untuk template ber-tombol / OTP, gunakan endpoint ini.

Untuk OTP: kirimkan kode yang sama di komponen body dan button.

Authorization

userApiKey
api_access_token<token>

This token can be obtained by visiting the profile page or via rails console. Provides access to endpoints based on the user permissions levels. This token can be saved by an external system when user is created via API, to perform activities on behalf of the user.

In: header

Path Parameters

account_id*integer

The numeric ID of the account

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://example.com/api/v1/accounts/0/whatsapp/send_template" \  -H "Content-Type: application/json" \  -d '{    "inbox_id": 57,    "to": "6281298956177",    "name": "otp",    "language": "en",    "components": [      {        "type": "body",        "parameters": [          {            "type": "text",            "text": "123456"          }        ]      },      {        "type": "button",        "sub_type": "url",        "index": "0",        "parameters": [          {            "type": "text",            "text": "123456"          }        ]      }    ]  }'

{
  "messaging_product": "whatsapp",
  "contacts": [
    {
      "input": "6281298956177",
      "wa_id": "6281298956177"
    }
  ],
  "messages": [
    {
      "id": "wamid.HBg...",
      "message_status": "accepted"
    }
  ]
}

Empty
{
  "error": "Inbox bukan WhatsApp Cloud API"
}