No parameter with header-text and body and footer Estimated reading: 2 minutes 72 views Endpoint:POST http://{{your_domain}}/api/v1.0/{{phone_number_id}}/{{key}}/messagesReplace the placeholders:{{key}}: Your API key for authentication.How to create key{{your_domain}}: Your API domain.{{phone_number_id}}: The ID linked to your WhatsApp Business API number.Headers:Content-Type: application/json Authorization: Bearer <your_access_token>Example Payload:{ "messaging_product": "whatsapp", "recipient_type": "individual", "to": "91xxxxxxxxxx", "type": "template", "template": { "name": "utility_g", "language": { "code": "en_us" }, "components": [ ] } }6. Key Components in the Payloadmessaging_productType: String Description: Specifies the messaging platform. Always set to "whatsapp".recipient_typeType: String Description: Defines the recipient type. Use "individual" for one-on-one messaging.toType: String Description: The recipient’s WhatsApp number in international format (e.g., "91xxxxxxxxxx").typeType: String Description: Defines the type of message. Always set to "template".template.nameType: String Description: Specifies the pre-approved WhatsApp template name. In this case, it is "utility_g".template.language.codeType: String Description: Language code for the template. The value should match the approved template settings. Example: "en_us" for English (United States).componentsType: Array Description: This field is empty ([]) since the utility_g template does not include any dynamic content.7. Expected API ResponseWhen the request is successful, the API will return an HTTP 200 OK status along with the following JSON response:{ "messaging_product": "whatsapp", "contacts": [ { "input": "91xxxxxxxxxx", "wa_id": "91xxxxxxxxxx", "status_id": "NTg0MTc=" } ], "messages": [ { "id": "M2s4da2y4P", "message_status": "accepted" } ] }Response Field Descriptionsmessaging_productType: String Description: Always returns "whatsapp" to indicate the platform.contactsType: Array Description: Contains recipient details.Fields within contacts:input: The phone number used in the API request. wa_id: WhatsApp ID linked to the phone number. status_id: A unique identifier representing the status of the message.messagesType: Array Description: Contains information about the sent message.Fields within messages:id: A unique message identifier. message_status: Indicates the status of the message processing."accepted" – The message was successfully processed. 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 xxxxxxxxxxx……….’ \ –header ‘Cookie: XSRF-TOKEN=xxxxxxxxxxx……….’ \ –data ‘{ “messaging_product”: “whatsapp”, “recipient_type”: “individual”, “to”: “91xxxxxxxxxx”, “type”: “template”, “template”: { “name”: “utility_g”, “language”: { “code”: “en_us” }, “components”: [ ] } }’ ‘<'+'?'+'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”, “type”: “template”, “template”: { “name”: “utility_g”, “language”: { “code”: “en_us” }, “components”: [ ] } }’, CURLOPT_HTTPHEADER => array( ‘Content-Type: application/json’, ‘Authorization: Bearer xxxxxxxxxxx……….’, ‘Cookie: XSRF-TOKEN=xxxxxxxxxxx……….’ ), )); $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 \”type\”: \”template\”,\r\n \”template\”: {\r\n \”name\”: \”utility_g\”,\r\n \”language\”: {\r\n \”code\”: \”en_us\”\r\n },\r\n \”components\”: [\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 xxxxxxxxxxx……….”) .addHeader(“Cookie”, “XSRF-TOKEN=xxxxxxxxxxx……….”) .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 xxxxxxxxxxx……….” request[“Cookie”] = “XSRF-TOKEN=xxxxxxxxxxx……….” request.body = JSON.dump({ “messaging_product”: “whatsapp”, “recipient_type”: “individual”, “to”: “91xxxxxxxxxx”, “type”: “template”, “template”: { “name”: “utility_g”, “language”: { “code”: “en_us” }, “components”: [] } }) 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”, “type”: “template”, “template”: { “name”: “utility_g”, “language”: { “code”: “en_us” }, “components”: [] } }) headers = { ‘Content-Type’: ‘application/json’, ‘Authorization’: ‘Bearer xxxxxxxxxxx……….’, ‘Cookie’: ‘XSRF-TOKEN=xxxxxxxxxxx……….’ } 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 xxxxxxxxxxx……….”); request.Headers.Add(“Cookie”, “XSRF-TOKEN=xxxxxxxxxxx……….”); var content = new StringContent(“{\r\n \”messaging_product\”: \”whatsapp\”,\r\n \”recipient_type\”: \”individual\”,\r\n \”to\”: \”91xxxxxxxxxx\”,\r\n \”type\”: \”template\”,\r\n \”template\”: {\r\n \”name\”: \”utility_g\”,\r\n \”language\”: {\r\n \”code\”: \”en_us\”\r\n },\r\n \”components\”: [\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 request = require(‘request’); var options = { ‘method’: ‘POST’, ‘url’: ‘https://example.com/api/v1.0/phone_number_id/key/messages’, ‘headers’: { ‘Content-Type’: ‘application/json’, ‘Authorization’: ‘Bearer xxxxxxxxxxx……….’, ‘Cookie’: ‘XSRF-TOKEN=xxxxxxxxxxx……….’ }, body: JSON.stringify({ “messaging_product”: “whatsapp”, “recipient_type”: “individual”, “to”: “91xxxxxxxxxx”, “type”: “template”, “template”: { “name”: “utility_g”, “language”: { “code”: “en_us” }, “components”: [] } }) }; request(options, function (error, response) { if (error) throw new Error(error); console.log(response.body); });