Send a message
This endpoint allows you to send a message via Whatsapp Business API. You can send text messages, media messages, and more.
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ”Payload containing the message and recipient information.
Payload for sending a template message via Whatsapp Business API. This variant is used when you want to send a pre-defined template message.
object
5215512345678525512345679eswelcome_utilityobject
object
[ "John Doe", "john@doe.com"]object
[ "John Doe"]Payload for sending a text message via Whatsapp Business API. This variant is used when you want to send a simple text message.
object
5215512345678525512345679This is a text message sent via Whatsapp Business API.Payload for sending an image message via Whatsapp Business API. This variant is used when you want to send an image.
object
5215512345678525512345679sample01.jpghttps://www.buildquickbots.com/whatsapp/media/sample/jpg/sample01.jpgPayload for sending a file message via Whatsapp Business API. This variant is used when you want to send a file (e.g., PDF, DOCX).
object
5215512345678525512345679sample01.pdfhttps://www.buildquickbots.com/whatsapp/media/sample/pdf/sample01.pdfPayload for sending an audio message via Whatsapp Business API. This variant is used when you want to send an audio file.
object
5215512345678525512345679https://www.buildquickbots.com/whatsapp/media/sample/audio/sample02.mp3Payload for sending a video message via Whatsapp Business API. This variant is used when you want to send a video file.
object
5215512345678525512345679https://www.buildquickbots.com/whatsapp/media/sample/video/sample01.mp4Responses
Section titled “ Responses ”Message sent successfully
object
200Message enqueued successfullyExample
{ "error": false, "code": 200, "message": "Message enqueued successfully"}Agent field must be specified to send WAB message
object
true304Agent field must be specified to send WAB messageExample
{ "error": true, "code": 304, "message": "Agent field must be specified to send WAB message"}Number field must be specified to send WAB message
object
true305Number field must be specified to send WAB messageExample
{ "error": true, "code": 305, "message": "Number field must be specified to send WAB message"}Please user number in E.164 format
object
true306Please user number in E.164 formatExample
{ "error": true, "code": 306, "message": "Please user number in E.164 format"}Type field must be specified to send WAB message
object
true307Type field must be specified to send WAB messageExample
{ "error": true, "code": 307, "message": "Type field must be specified to send WAB message"}Agent or User are invalid
object
true400Agent or User are invalidExample
{ "error": true, "code": 400, "message": "Agent or User are invalid"}Whatsapp agent isn’t valid or not found
object
true404Whatsapp agent isn't valid or not foundExample
{ "error": true, "code": 404, "message": "Whatsapp agent isn't valid or not found"}Error enqueuing message
object
true500Error enqueuing messageExample
{ "error": true, "code": 500, "message": "Error enqueuing message"}Examples
Section titled “Examples ”Useful for guiding users to view code examples in different developer languages.
curl -X POST "https://api.example.com/wab" \ -H "Accept: application/json" \ -H "Connection: keep-alive" \ -H "Content-Type: application/json" \ -H "Authorization: Basic <base64-encoded-credentials>" \ -d '{}' const fetch = require('node-fetch');
fetch("https://api.example.com/wab", { method: "POST", headers: { "Accept": "application/json", "Connection": "keep-alive", "Content-Type": "application/json", "Authorization": "Basic <base64-encoded-credentials>"}, body: JSON.stringify({}) }) .then(res => res.json()) .then(console.log) .catch(console.error); <?php $curl = curl_init();
curl_setopt_array($curl, [ CURLOPT_URL => "https://api.example.com/wab", CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_HTTPHEADER => [ "Accept: application/json", "Connection: keep-alive", "Content-Type: application/json", "Authorization: Basic <base64-encoded-credentials>" ], CURLOPT_POSTFIELDS => json_encode({}) ]);
$response = curl_exec($curl); curl_close($curl); echo $response; ?> using System.Net.Http; using System.Text; using System.Threading.Tasks;
var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.POST, "https://api.example.com/wab") { Content = new StringContent("{}", Encoding.UTF8, "application/json") }; request.Headers.Add("Accept", "application/json");request.Headers.Add("Connection", "keep-alive");request.Headers.Add("Content-Type", "application/json");request.Headers.Add("Authorization", "Basic <base64-encoded-credentials>"); var response = await client.SendAsync(request); var responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody); import requests import json
url = "https://api.example.com/wab" headers = { "Accept": "application/json", "Connection": "keep-alive", "Content-Type": "application/json", "Authorization": "Basic <base64-encoded-credentials>" } data = {}
response = requests.post(url, headers=headers, json=data) print(response.text) import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.nio.charset.StandardCharsets;
public class ApiExample { public static void main(String[] args) throws Exception { URL url = new URL("https://api.example.com/wab"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setDoOutput(true); conn.setRequestProperty("Accept", "application/json"); conn.setRequestProperty("Connection", "keep-alive"); conn.setRequestProperty("Content-Type", "application/json"); conn.setRequestProperty("Authorization", "Basic <base64-encoded-credentials>");
String jsonInputString = "{}"; try(OutputStream os = conn.getOutputStream()) { byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8); os.write(input, 0, input.length); }
int code = conn.getResponseCode(); System.out.println("Response code: " + code); } }