No parameter with body and button with quick-replay , visit-website , phone-number and copy-code Estimated reading: 3 minutes 208 views PingtoChat’s Marketing Category enables businesses to send pre-approved WhatsApp template messages through the WhatsApp Business API. The supported message types include: Messages Without Parameters Messages With Parameters Messages With Parameters and Attachments Messages With Buttons (Quick Reply, URL, Phone Number, Copy Code) For URL and Phone Number buttons, they do not need to be included in the Example payload. Description: A basic template message without dynamic parameters. Endpoint: http://{{your_domain}}/api/v1.0/{{phone_number_id}}/{{key}}/messages Method: POST Headers: Content-Type: application/json Authorization: Bearer <your_access_token> Example Payload: { "messaging_product": "whatsapp", "recipient_type": "individual", "to": "91xxxxxxxxxx", "type": "template", "template": { "name": "markting_s", "language": { "code": "en_us" }, "components": [ { "type": "button", "sub_type": "quick_reply", "index": 0, "parameters": [ { "type": "text", "text": "Unsubscribe from Promos" } ] }, { "type": "button", "sub_type": "copy_code", "index": 1, "parameters": [ { "type": "text", "text": "WRETTT" } ] } ] } } Key Components in the Payload messaging_product Type: String Description: Specifies the messaging platform. Always set to "whatsapp". recipient_type Type: String Description: Defines the recipient type. Use "individual" for one-on-one messaging. to Type: String Description: The recipient’s WhatsApp number in international format (e.g., "91xxxxxxxxxx"). type Type: String Description: Defines the type of message. Always set to "template". template.name Type: String Description: Specifies the pre-approved WhatsApp template name. In this case, it is "markting_s". template.language.code Type: String Description: Language code for the template. Must match the approved template settings. Example: "en_us" for English (United States). components Type: Array Description: Defines the interactive elements in the template. Quick Reply Button Type: button Description: Adds an interactive Quick Reply button. sub_type Value: "quick_reply" Description: Defines the button as a Quick Reply. "quick_reply": Provides a predefined response option. index Type: Integer Description: Position of the button in the template. "0": The first button. parameters Type: `Array** Description: Defines the button text. text: "Unsubscribe from Promos" Copy Code Button Type: button Description: Adds a Copy Code button. sub_type Value: "copy_code" Description: Defines the button as a Copy Code button. "copy_code": Allows users to copy a predefined code. index Type: Integer Description: Position of the button in the template. "1": The second button. parameters Type: `Array** Description: Defines the text associated with the Copy Code button. text: "WRETTT" Response If the request is successful, the API returns a 200 OK response with the following JSON structure: { "messaging_product": "whatsapp", "contacts": [ { "input": "91xxxxxxxxxx", "wa_id": "91xxxxxxxxxx", "status_id": "NTg0MTc=" } ], "messages": [ { "id": "M2s4da2y4P", "message_status": "accepted" } ] } Response Field Descriptions messaging_product Type: String Description: Always returns "whatsapp". contacts Type: `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 for message status. messages Type: `Array** Description: Contains details about the sent message. Fields within messages: id: A unique message identifier. message_status: Indicates the message processing status. "accepted": The message was successfully processed. Sample codes CURL PHP Java Ruby Python C# Node JS curl –location ‘https://app.pingtochat.com/api/v1.0/313137333231393/315f70696e67746f63686174/messages’ \ –header ‘authToken: xxxxxxxxxxxxx………………….’ \ –header ‘Content-Type: application/json’ \ –header ‘Authorization: Bearer xxxxxxxxxxxxx………………….’ \ –data ‘{ “messaging_product”: “whatsapp”, “recipient_type”: “individual”, “to”: “91xxxxxxxxxx”, “type”: “template”, “template”: { “name”: “markting_s”, “language”: { “code”: “en_us” }, “components”: [ { “type”: “button”, “sub_type”: “quick_reply”, “index”: 0, “parameters”: [ { “type”: “text”, “text”: “Unsubscribe from Promos” } ] }, { “type”: “button”, “sub_type”: “copy_code”, “index”: 1, “parameters”: [ { “type”: “text”, “text”: “WRETTT” } ] } ] } }’ ‘<'+'?'+'php'+ ` $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => ‘https://app.pingtochat.com/api/v1.0/313137333231393/315f70696e67746f63686174/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”: “markting_s”, “language”: { “code”: “en_us” }, “components”: [ { “type”: “button”, “sub_type”: “quick_reply”, “index”: 0, “parameters”: [ { “type”: “text”, “text”: “Unsubscribe from Promos” } ] }, { “type”: “button”, “sub_type”: “copy_code”, “index”: 1, “parameters”: [ { “type”: “text”, “text”: “WRETTT” } ] } ] } }’, CURLOPT_HTTPHEADER => array( ‘authToken: xxxxxxxxxxxxx………………….’, ‘: ‘, ‘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 \”type\”: \”template\”,\r\n \”template\”: {\r\n \”name\”: \”markting_s\”,\r\n \”language\”: {\r\n \”code\”: \”en_us\”\r\n },\r\n \”components\”: [\r\n {\r\n \”type\”: \”button\”,\r\n \”sub_type\”: \”quick_reply\”, \r\n \”index\”: 0,\r\n \”parameters\”: [\r\n {\r\n \”type\”: \”text\”,\r\n \”text\”: \”Unsubscribe from Promos\”\r\n }\r\n ]\r\n },\r\n {\r\n \”type\”: \”button\”,\r\n \”sub_type\”: \”copy_code\”, \r\n \”index\”: 1,\r\n \”parameters\”: [\r\n {\r\n \”type\”: \”text\”,\r\n \”text\”: \”WRETTT\” \r\n }\r\n ]\r\n }\r\n ]\r\n }\r\n}”); Request request = new Request.Builder() .url(“https://app.pingtochat.com/api/v1.0/313137333231393/315f70696e67746f63686174/messages”) .method(“POST”, body) .addHeader(“authToken”, “xxxxxxxxxxxxx………………….”) .addHeader(“”, “”) .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://app.pingtochat.com/api/v1.0/313137333231393/315f70696e67746f63686174/messages”) https = Net::HTTP.new(url.host, url.port) https.use_ssl = true request = Net::HTTP::Post.new(url) request[“authToken”] = “xxxxxxxxxxxxx………………….” request[“”] = “” request[“Content-Type”] = “application/json” request[“Authorization”] = “Bearer xxxxxxxxxxxxx………………….” request.body = JSON.dump({ “messaging_product”: “whatsapp”, “recipient_type”: “individual”, “to”: “91xxxxxxxxxx”, “type”: “template”, “template”: { “name”: “markting_s”, “language”: { “code”: “en_us” }, “components”: [ { “type”: “button”, “sub_type”: “quick_reply”, “index”: 0, “parameters”: [ { “type”: “text”, “text”: “Unsubscribe from Promos” } ] }, { “type”: “button”, “sub_type”: “copy_code”, “index”: 1, “parameters”: [ { “type”: “text”, “text”: “WRETTT” } ] } ] } }) response = https.request(request) puts response.read_body import requests import json url = “https://app.pingtochat.com/api/v1.0/313137333231393/315f70696e67746f63686174/messages” payload = json.dumps({ “messaging_product”: “whatsapp”, “recipient_type”: “individual”, “to”: “91xxxxxxxxxx”, “type”: “template”, “template”: { “name”: “markting_s”, “language”: { “code”: “en_us” }, “components”: [ { “type”: “button”, “sub_type”: “quick_reply”, “index”: 0, “parameters”: [ { “type”: “text”, “text”: “Unsubscribe from Promos” } ] }, { “type”: “button”, “sub_type”: “copy_code”, “index”: 1, “parameters”: [ { “type”: “text”, “text”: “WRETTT” } ] } ] } }) headers = { ‘authToken’: ‘xxxxxxxxxxxxx………………….’, ”: ”, ‘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://app.pingtochat.com/api/v1.0/313137333231393/315f70696e67746f63686174/messages”); request.Headers.Add(“authToken”, “xxxxxxxxxxxxx………………….”); request.Headers.Add(“”, “”); 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 \”type\”: \”template\”,\r\n \”template\”: {\r\n \”name\”: \”markting_s\”,\r\n \”language\”: {\r\n \”code\”: \”en_us\”\r\n },\r\n \”components\”: [\r\n {\r\n \”type\”: \”button\”,\r\n \”sub_type\”: \”quick_reply\”, \r\n \”index\”: 0,\r\n \”parameters\”: [\r\n {\r\n \”type\”: \”text\”,\r\n \”text\”: \”Unsubscribe from Promos\”\r\n }\r\n ]\r\n },\r\n {\r\n \”type\”: \”button\”,\r\n \”sub_type\”: \”copy_code\”, \r\n \”index\”: 1,\r\n \”parameters\”: [\r\n {\r\n \”type\”: \”text\”,\r\n \”text\”: \”WRETTT\” \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 request = require(‘request’); var options = { ‘method’: ‘POST’, ‘url’: ‘https://app.pingtochat.com/api/v1.0/313137333231393/315f70696e67746f63686174/messages’, ‘headers’: { ‘authToken’: ‘xxxxxxxxxxxxx………………….’, ”: ”, ‘Content-Type’: ‘application/json’, ‘Authorization’: ‘Bearer xxxxxxxxxxxxx………………….’ }, body: JSON.stringify({ “messaging_product”: “whatsapp”, “recipient_type”: “individual”, “to”: “91xxxxxxxxxx”, “type”: “template”, “template”: { “name”: “markting_s”, “language”: { “code”: “en_us” }, “components”: [ { “type”: “button”, “sub_type”: “quick_reply”, “index”: 0, “parameters”: [ { “type”: “text”, “text”: “Unsubscribe from Promos” } ] }, { “type”: “button”, “sub_type”: “copy_code”, “index”: 1, “parameters”: [ { “type”: “text”, “text”: “WRETTT” } ] } ] } }) }; request(options, function (error, response) { if (error) throw new Error(error); console.log(response.body); });