Send a message via WhatsApp
Queues a message for delivery via WhatsApp. Supports 10 message types: text, image, video, audio, document, location, poll, contact, forward, and reaction. The message is processed asynchronously via BullMQ. Brazilian phone numbers are automatically retried with/without the 9th digit on failure.
curl --request POST \
--url https://api.wappfy.io/api/instances/{instanceId}/messages/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"to": "<string>",
"body": "<string>",
"media_url": "<string>",
"caption": "<string>",
"template_name": "<string>",
"template_params": {},
"quoted_message_id": "<string>",
"edit_message_id": "<string>",
"mentions": [
"<string>"
],
"contacts": [
{
"fullName": "<string>",
"phoneNumber": "<string>",
"organization": "<string>",
"whatsappId": "<string>"
}
],
"forward_message_id": "<string>",
"reaction": "<string>",
"reaction_message_id": "<string>"
}
'import requests
url = "https://api.wappfy.io/api/instances/{instanceId}/messages/send"
payload = {
"to": "<string>",
"body": "<string>",
"media_url": "<string>",
"caption": "<string>",
"template_name": "<string>",
"template_params": {},
"quoted_message_id": "<string>",
"edit_message_id": "<string>",
"mentions": ["<string>"],
"contacts": [
{
"fullName": "<string>",
"phoneNumber": "<string>",
"organization": "<string>",
"whatsappId": "<string>"
}
],
"forward_message_id": "<string>",
"reaction": "<string>",
"reaction_message_id": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
to: '<string>',
body: JSON.stringify('<string>'),
media_url: '<string>',
caption: '<string>',
template_name: '<string>',
template_params: {},
quoted_message_id: '<string>',
edit_message_id: '<string>',
mentions: ['<string>'],
contacts: [
{
fullName: '<string>',
phoneNumber: '<string>',
organization: '<string>',
whatsappId: '<string>'
}
],
forward_message_id: '<string>',
reaction: '<string>',
reaction_message_id: '<string>'
})
};
fetch('https://api.wappfy.io/api/instances/{instanceId}/messages/send', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wappfy.io/api/instances/{instanceId}/messages/send",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'to' => '<string>',
'body' => '<string>',
'media_url' => '<string>',
'caption' => '<string>',
'template_name' => '<string>',
'template_params' => [
],
'quoted_message_id' => '<string>',
'edit_message_id' => '<string>',
'mentions' => [
'<string>'
],
'contacts' => [
[
'fullName' => '<string>',
'phoneNumber' => '<string>',
'organization' => '<string>',
'whatsappId' => '<string>'
]
],
'forward_message_id' => '<string>',
'reaction' => '<string>',
'reaction_message_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.wappfy.io/api/instances/{instanceId}/messages/send"
payload := strings.NewReader("{\n \"to\": \"<string>\",\n \"body\": \"<string>\",\n \"media_url\": \"<string>\",\n \"caption\": \"<string>\",\n \"template_name\": \"<string>\",\n \"template_params\": {},\n \"quoted_message_id\": \"<string>\",\n \"edit_message_id\": \"<string>\",\n \"mentions\": [\n \"<string>\"\n ],\n \"contacts\": [\n {\n \"fullName\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"organization\": \"<string>\",\n \"whatsappId\": \"<string>\"\n }\n ],\n \"forward_message_id\": \"<string>\",\n \"reaction\": \"<string>\",\n \"reaction_message_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.wappfy.io/api/instances/{instanceId}/messages/send")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"to\": \"<string>\",\n \"body\": \"<string>\",\n \"media_url\": \"<string>\",\n \"caption\": \"<string>\",\n \"template_name\": \"<string>\",\n \"template_params\": {},\n \"quoted_message_id\": \"<string>\",\n \"edit_message_id\": \"<string>\",\n \"mentions\": [\n \"<string>\"\n ],\n \"contacts\": [\n {\n \"fullName\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"organization\": \"<string>\",\n \"whatsappId\": \"<string>\"\n }\n ],\n \"forward_message_id\": \"<string>\",\n \"reaction\": \"<string>\",\n \"reaction_message_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wappfy.io/api/instances/{instanceId}/messages/send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"to\": \"<string>\",\n \"body\": \"<string>\",\n \"media_url\": \"<string>\",\n \"caption\": \"<string>\",\n \"template_name\": \"<string>\",\n \"template_params\": {},\n \"quoted_message_id\": \"<string>\",\n \"edit_message_id\": \"<string>\",\n \"mentions\": [\n \"<string>\"\n ],\n \"contacts\": [\n {\n \"fullName\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"organization\": \"<string>\",\n \"whatsappId\": \"<string>\"\n }\n ],\n \"forward_message_id\": \"<string>\",\n \"reaction\": \"<string>\",\n \"reaction_message_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "Message queued for delivery",
"jobId": "42"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The WhatsApp instance UUID
"a1b2c3d4-e5f6-7890-abcd-ef1234567890"
Body
Recipient phone number or chatId
text, image, video, audio, document, location, template, poll, contact, forward, reaction Show child attributes
Show child attributes
Message ID to reply/quote
Message ID to edit
@mentions (phone numbers with @c.us)
Poll data (type=poll)
Show child attributes
Show child attributes
Contact cards (type=contact)
Show child attributes
Show child attributes
Message ID to forward (type=forward)
Reaction emoji (type=reaction), empty string to remove
Message ID to react to (type=reaction)
Was this page helpful?
curl --request POST \
--url https://api.wappfy.io/api/instances/{instanceId}/messages/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"to": "<string>",
"body": "<string>",
"media_url": "<string>",
"caption": "<string>",
"template_name": "<string>",
"template_params": {},
"quoted_message_id": "<string>",
"edit_message_id": "<string>",
"mentions": [
"<string>"
],
"contacts": [
{
"fullName": "<string>",
"phoneNumber": "<string>",
"organization": "<string>",
"whatsappId": "<string>"
}
],
"forward_message_id": "<string>",
"reaction": "<string>",
"reaction_message_id": "<string>"
}
'import requests
url = "https://api.wappfy.io/api/instances/{instanceId}/messages/send"
payload = {
"to": "<string>",
"body": "<string>",
"media_url": "<string>",
"caption": "<string>",
"template_name": "<string>",
"template_params": {},
"quoted_message_id": "<string>",
"edit_message_id": "<string>",
"mentions": ["<string>"],
"contacts": [
{
"fullName": "<string>",
"phoneNumber": "<string>",
"organization": "<string>",
"whatsappId": "<string>"
}
],
"forward_message_id": "<string>",
"reaction": "<string>",
"reaction_message_id": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
to: '<string>',
body: JSON.stringify('<string>'),
media_url: '<string>',
caption: '<string>',
template_name: '<string>',
template_params: {},
quoted_message_id: '<string>',
edit_message_id: '<string>',
mentions: ['<string>'],
contacts: [
{
fullName: '<string>',
phoneNumber: '<string>',
organization: '<string>',
whatsappId: '<string>'
}
],
forward_message_id: '<string>',
reaction: '<string>',
reaction_message_id: '<string>'
})
};
fetch('https://api.wappfy.io/api/instances/{instanceId}/messages/send', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wappfy.io/api/instances/{instanceId}/messages/send",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'to' => '<string>',
'body' => '<string>',
'media_url' => '<string>',
'caption' => '<string>',
'template_name' => '<string>',
'template_params' => [
],
'quoted_message_id' => '<string>',
'edit_message_id' => '<string>',
'mentions' => [
'<string>'
],
'contacts' => [
[
'fullName' => '<string>',
'phoneNumber' => '<string>',
'organization' => '<string>',
'whatsappId' => '<string>'
]
],
'forward_message_id' => '<string>',
'reaction' => '<string>',
'reaction_message_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.wappfy.io/api/instances/{instanceId}/messages/send"
payload := strings.NewReader("{\n \"to\": \"<string>\",\n \"body\": \"<string>\",\n \"media_url\": \"<string>\",\n \"caption\": \"<string>\",\n \"template_name\": \"<string>\",\n \"template_params\": {},\n \"quoted_message_id\": \"<string>\",\n \"edit_message_id\": \"<string>\",\n \"mentions\": [\n \"<string>\"\n ],\n \"contacts\": [\n {\n \"fullName\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"organization\": \"<string>\",\n \"whatsappId\": \"<string>\"\n }\n ],\n \"forward_message_id\": \"<string>\",\n \"reaction\": \"<string>\",\n \"reaction_message_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.wappfy.io/api/instances/{instanceId}/messages/send")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"to\": \"<string>\",\n \"body\": \"<string>\",\n \"media_url\": \"<string>\",\n \"caption\": \"<string>\",\n \"template_name\": \"<string>\",\n \"template_params\": {},\n \"quoted_message_id\": \"<string>\",\n \"edit_message_id\": \"<string>\",\n \"mentions\": [\n \"<string>\"\n ],\n \"contacts\": [\n {\n \"fullName\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"organization\": \"<string>\",\n \"whatsappId\": \"<string>\"\n }\n ],\n \"forward_message_id\": \"<string>\",\n \"reaction\": \"<string>\",\n \"reaction_message_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wappfy.io/api/instances/{instanceId}/messages/send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"to\": \"<string>\",\n \"body\": \"<string>\",\n \"media_url\": \"<string>\",\n \"caption\": \"<string>\",\n \"template_name\": \"<string>\",\n \"template_params\": {},\n \"quoted_message_id\": \"<string>\",\n \"edit_message_id\": \"<string>\",\n \"mentions\": [\n \"<string>\"\n ],\n \"contacts\": [\n {\n \"fullName\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"organization\": \"<string>\",\n \"whatsappId\": \"<string>\"\n }\n ],\n \"forward_message_id\": \"<string>\",\n \"reaction\": \"<string>\",\n \"reaction_message_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "Message queued for delivery",
"jobId": "42"
}