Parameter with button Estimated reading: 2 minutes 64 views This API enables you to send WhatsApp authentication template messages using the provided template configuration. The messages are sent to individual recipients using a specific template ID, phone number ID, and API key.Request FormatHTTP MethodPOSTAPI VersionV1.0Request URL http://{{your_domain}}/api/v1.0/{{phone_number_id}}/{{key}}/messagesReplace placeholders:{{your_domain}}: Your domain URL where the API is hosted. {{phone_number_id}}: The unique identifier of the phone number used for sending messages. {{key}}: Your API key for authentication.How to create keyRequest Body{ "messaging_product": "whatsapp", "recipient_type": "individual", "to": "91xxxxxxxxxx", "bulk_id":"12345", "type": "template", "template": { "name": "authentication_template", "language": { "code": "en" }, "components": [ { "type": "body", "parameters": [ { "type": "text", "text": "958625" } ] }, { "type": "button", "sub_type": "url", "index": "0", "parameters": [ { "type": "text", "text": "958625" } ] } ] } } ResponseSuccess ResponseHTTP Status Code: 200 OKSample Response:{ "messaging_product": "whatsapp", "contacts": [ { "input": "91xxxxxxxxxx", "wa_id": "91xxxxxxxxxx", "status_id": "ODIxMTE=" } ], "messages": [ { "id": "RFPQoMGZWt", "message_status": "accepted" } ] }Message Sample View958625 is your verification code. For your security, do not share this code.Field DescriptionsRoot-Level FieldsFieldTypeDescriptionmessaging_productstringMust be whatsapp. Identifies the messaging platform being used.recipient_typestringMust be individual. Specifies the type of recipient.tostringThe recipient’s phone number in E.164 format (e.g., 91xxxxxxxxxx).typestringMust be template. Specifies the type of message being sent.Template-Level FieldsFieldTypeDescriptionnameStringName of the template. For example, "otp_message".languageObjectSpecifies the language of the template.componentsArrayContains the components of the message (body, buttons).NotesEnsure the template name matches an approved template in your WhatsApp Business Account. The phone number must be in E.164 format (e.g., 91xxxxxxxxxx for Indian numbers). Language codes must follow ISO 639-1 standards. Sample codes CURL PHP Java Ruby Python C# Node JS curl –location ‘https://example.com/api/v1.0/phone_number_id/key/messages’ \ –header ‘Content-Type: application/json’ \ –header ‘Authorization: Bearer xxxxxxxxxxxxx………………….’ \ –data ‘{ “messaging_product”: “whatsapp”, “recipient_type”: “individual”, “to”: “91xxxxxxxxxx”, “bulk_id”:”12345″, “type”: “template”, “template”: { “name”: “authentication_template”, “language”: { “code”: “en” }, “components”: [ { “type”: “body”, “parameters”: [ { “type”: “text”, “text”: “958625” } ] }, { “type”: “button”, “sub_type”: “url”, “index”: “0”, “parameters”: [ { “type”: “text”, “text”: “958625” } ] } ] } }’ ‘<'+'?'+'php'+ ` $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => ‘https://example.com/api/v1.0/phone_number_id/key/messages’, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => ”, CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => ‘POST’, CURLOPT_POSTFIELDS =>'{ “messaging_product”: “whatsapp”, “recipient_type”: “individual”, “to”: “91xxxxxxxxxx”, “bulk_id”:”12345″, “type”: “template”, “template”: { “name”: “authentication_template”, “language”: { “code”: “en” }, “components”: [ { “type”: “body”, “parameters”: [ { “type”: “text”, “text”: “958625” } ] }, { “type”: “button”, “sub_type”: “url”, “index”: “0”, “parameters”: [ { “type”: “text”, “text”: “958625” } ] } ] } }’, CURLOPT_HTTPHEADER => array( ‘Content-Type: application/json’, ‘Authorization: Bearer xxxxxxxxxxxxx………………….’ ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ?>;`; OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse(“application/json”); RequestBody body = RequestBody.create(mediaType, “{\r\n \”messaging_product\”: \”whatsapp\”,\r\n \”recipient_type\”: \”individual\”,\r\n \”to\”: \”91xxxxxxxxxx\”,\r\n \”bulk_id\”:\”12345\”,\r\n \”type\”: \”template\”,\r\n \”template\”: {\r\n \”name\”: \”authentication_template\”,\r\n \”language\”: {\r\n \”code\”: \”en\”\r\n },\r\n \”components\”: [\r\n {\r\n \”type\”: \”body\”,\r\n \”parameters\”: [\r\n {\r\n \”type\”: \”text\”,\r\n \”text\”: \”958625\”\r\n }\r\n ]\r\n },\r\n {\r\n \”type\”: \”button\”,\r\n \”sub_type\”: \”url\”,\r\n \”index\”: \”0\”,\r\n \”parameters\”: [\r\n {\r\n \”type\”: \”text\”,\r\n \”text\”: \”958625\”\r\n }\r\n ]\r\n }\r\n ]\r\n }\r\n}”); Request request = new Request.Builder() .url(“https://example.com/api/v1.0/phone_number_id/key/messages”) .method(“POST”, body) .addHeader(“Content-Type”, “application/json”) .addHeader(“Authorization”, “Bearer xxxxxxxxxxxxx………………….”) .build(); Response response = client.newCall(request).execute(); require “uri” require “json” require “net/http” url = URI(“https://example.com/api/v1.0/phone_number_id/key/messages”) https = Net::HTTP.new(url.host, url.port) https.use_ssl = true request = Net::HTTP::Post.new(url) request[“Content-Type”] = “application/json” request[“Authorization”] = “Bearer xxxxxxxxxxxxx………………….” request.body = JSON.dump({ “messaging_product”: “whatsapp”, “recipient_type”: “individual”, “to”: “91xxxxxxxxxx”, “bulk_id”: “12345”, “type”: “template”, “template”: { “name”: “authentication_template”, “language”: { “code”: “en” }, “components”: [ { “type”: “body”, “parameters”: [ { “type”: “text”, “text”: “958625” } ] }, { “type”: “button”, “sub_type”: “url”, “index”: “0”, “parameters”: [ { “type”: “text”, “text”: “958625” } ] } ] } }) response = https.request(request) puts response.read_body import requests import json url = “https://example.com/api/v1.0/phone_number_id/key/messages” payload = json.dumps({ “messaging_product”: “whatsapp”, “recipient_type”: “individual”, “to”: “91xxxxxxxxxx”, “bulk_id”: “12345”, “type”: “template”, “template”: { “name”: “authentication_template”, “language”: { “code”: “en” }, “components”: [ { “type”: “body”, “parameters”: [ { “type”: “text”, “text”: “958625” } ] }, { “type”: “button”, “sub_type”: “url”, “index”: “0”, “parameters”: [ { “type”: “text”, “text”: “958625” } ] } ] } }) headers = { ‘Content-Type’: ‘application/json’, ‘Authorization’: ‘Bearer xxxxxxxxxxxxx………………….’ } response = requests.request(“POST”, url, headers=headers, data=payload) print(response.text) var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Post, “https://example.com/api/v1.0/phone_number_id/key/messages”); request.Headers.Add(“Authorization”, “Bearer xxxxxxxxxxxxx………………….”); var content = new StringContent(“{\r\n \”messaging_product\”: \”whatsapp\”,\r\n \”recipient_type\”: \”individual\”,\r\n \”to\”: \”91xxxxxxxxxx\”,\r\n \”bulk_id\”:\”12345\”,\r\n \”type\”: \”template\”,\r\n \”template\”: {\r\n \”name\”: \”authentication_template\”,\r\n \”language\”: {\r\n \”code\”: \”en\”\r\n },\r\n \”components\”: [\r\n {\r\n \”type\”: \”body\”,\r\n \”parameters\”: [\r\n {\r\n \”type\”: \”text\”,\r\n \”text\”: \”958625\”\r\n }\r\n ]\r\n },\r\n {\r\n \”type\”: \”button\”,\r\n \”sub_type\”: \”url\”,\r\n \”index\”: \”0\”,\r\n \”parameters\”: [\r\n {\r\n \”type\”: \”text\”,\r\n \”text\”: \”958625\”\r\n }\r\n ]\r\n }\r\n ]\r\n }\r\n}”, null, “application/json”); request.Content = content; var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Post, “https://example.com/api/v1.0/phone_number_id/key/messages”); request.Headers.Add(“Authorization”, “Bearer xxxxxxxxxxxxx………………….”); var content = new StringContent(“{\r\n \”messaging_product\”: \”whatsapp\”,\r\n \”recipient_type\”: \”individual\”,\r\n \”to\”: \”91xxxxxxxxxx\”,\r\n \”bulk_id\”:\”12345\”,\r\n \”type\”: \”template\”,\r\n \”template\”: {\r\n \”name\”: \”authentication_template\”,\r\n \”language\”: {\r\n \”code\”: \”en\”\r\n },\r\n \”components\”: [\r\n {\r\n \”type\”: \”body\”,\r\n \”parameters\”: [\r\n {\r\n \”type\”: \”text\”,\r\n \”text\”: \”958625\”\r\n }\r\n ]\r\n },\r\n {\r\n \”type\”: \”button\”,\r\n \”sub_type\”: \”url\”,\r\n \”index\”: \”0\”,\r\n \”parameters\”: [\r\n {\r\n \”type\”: \”text\”,\r\n \”text\”: \”958625\”\r\n }\r\n ]\r\n }\r\n ]\r\n }\r\n}”, null, “application/json”); request.Content = content; var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync());