Send a message
Send any WhatsApp Cloud API message. type selects the kind: text, image, audio, video, document, sticker, location, contacts, interactive, template, reaction.
curl --request POST \
--url https://pilotstatus.com.br/api/layer/meta/{phoneNumberId}/messages \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"messaging_product": "whatsapp",
"to": "5511999999999",
"type": "text",
"recipient_type": "individual",
"text": {
"preview_url": false,
"body": "Hello from Pilot Status 👋"
},
"image": {
"id": "<string>",
"link": "<string>",
"caption": "<string>"
},
"audio": {
"id": "<string>",
"link": "<string>"
},
"video": {
"id": "<string>",
"link": "<string>",
"caption": "<string>"
},
"document": {
"id": "<string>",
"link": "<string>",
"caption": "<string>",
"filename": "<string>"
},
"sticker": {
"id": "<string>",
"link": "<string>"
},
"contacts": [
{}
],
"interactive": {
"type": "<string>",
"header": {},
"body": {
"text": "<string>"
},
"footer": {
"text": "<string>"
},
"action": {}
},
"template": {
"name": "<string>",
"language": {
"code": "<string>"
},
"components": [
{}
]
},
"reaction": {
"message_id": "<string>",
"emoji": "<string>"
},
"context": {
"message_id": "<string>"
}
}
'import requests
url = "https://pilotstatus.com.br/api/layer/meta/{phoneNumberId}/messages"
payload = {
"messaging_product": "whatsapp",
"to": "5511999999999",
"type": "text",
"recipient_type": "individual",
"text": {
"preview_url": False,
"body": "Hello from Pilot Status 👋"
},
"image": {
"id": "<string>",
"link": "<string>",
"caption": "<string>"
},
"audio": {
"id": "<string>",
"link": "<string>"
},
"video": {
"id": "<string>",
"link": "<string>",
"caption": "<string>"
},
"document": {
"id": "<string>",
"link": "<string>",
"caption": "<string>",
"filename": "<string>"
},
"sticker": {
"id": "<string>",
"link": "<string>"
},
"contacts": [{}],
"interactive": {
"type": "<string>",
"header": {},
"body": { "text": "<string>" },
"footer": { "text": "<string>" },
"action": {}
},
"template": {
"name": "<string>",
"language": { "code": "<string>" },
"components": [{}]
},
"reaction": {
"message_id": "<string>",
"emoji": "<string>"
},
"context": { "message_id": "<string>" }
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
messaging_product: 'whatsapp',
to: '5511999999999',
type: 'text',
recipient_type: 'individual',
text: {preview_url: false, body: JSON.stringify('Hello from Pilot Status 👋')},
image: {id: '<string>', link: '<string>', caption: '<string>'},
audio: {id: '<string>', link: '<string>'},
video: {id: '<string>', link: '<string>', caption: '<string>'},
document: {id: '<string>', link: '<string>', caption: '<string>', filename: '<string>'},
sticker: {id: '<string>', link: '<string>'},
contacts: [{}],
interactive: {
type: '<string>',
header: {},
body: JSON.stringify({text: '<string>'}),
footer: {text: '<string>'},
action: {}
},
template: {name: '<string>', language: {code: '<string>'}, components: [{}]},
reaction: {message_id: '<string>', emoji: '<string>'},
context: {message_id: '<string>'}
})
};
fetch('https://pilotstatus.com.br/api/layer/meta/{phoneNumberId}/messages', 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://pilotstatus.com.br/api/layer/meta/{phoneNumberId}/messages",
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([
'messaging_product' => 'whatsapp',
'to' => '5511999999999',
'type' => 'text',
'recipient_type' => 'individual',
'text' => [
'preview_url' => false,
'body' => 'Hello from Pilot Status 👋'
],
'image' => [
'id' => '<string>',
'link' => '<string>',
'caption' => '<string>'
],
'audio' => [
'id' => '<string>',
'link' => '<string>'
],
'video' => [
'id' => '<string>',
'link' => '<string>',
'caption' => '<string>'
],
'document' => [
'id' => '<string>',
'link' => '<string>',
'caption' => '<string>',
'filename' => '<string>'
],
'sticker' => [
'id' => '<string>',
'link' => '<string>'
],
'contacts' => [
[
]
],
'interactive' => [
'type' => '<string>',
'header' => [
],
'body' => [
'text' => '<string>'
],
'footer' => [
'text' => '<string>'
],
'action' => [
]
],
'template' => [
'name' => '<string>',
'language' => [
'code' => '<string>'
],
'components' => [
[
]
]
],
'reaction' => [
'message_id' => '<string>',
'emoji' => '<string>'
],
'context' => [
'message_id' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://pilotstatus.com.br/api/layer/meta/{phoneNumberId}/messages"
payload := strings.NewReader("{\n \"messaging_product\": \"whatsapp\",\n \"to\": \"5511999999999\",\n \"type\": \"text\",\n \"recipient_type\": \"individual\",\n \"text\": {\n \"preview_url\": false,\n \"body\": \"Hello from Pilot Status 👋\"\n },\n \"image\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\",\n \"caption\": \"<string>\"\n },\n \"audio\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\"\n },\n \"video\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\",\n \"caption\": \"<string>\"\n },\n \"document\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\",\n \"caption\": \"<string>\",\n \"filename\": \"<string>\"\n },\n \"sticker\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\"\n },\n \"contacts\": [\n {}\n ],\n \"interactive\": {\n \"type\": \"<string>\",\n \"header\": {},\n \"body\": {\n \"text\": \"<string>\"\n },\n \"footer\": {\n \"text\": \"<string>\"\n },\n \"action\": {}\n },\n \"template\": {\n \"name\": \"<string>\",\n \"language\": {\n \"code\": \"<string>\"\n },\n \"components\": [\n {}\n ]\n },\n \"reaction\": {\n \"message_id\": \"<string>\",\n \"emoji\": \"<string>\"\n },\n \"context\": {\n \"message_id\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://pilotstatus.com.br/api/layer/meta/{phoneNumberId}/messages")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"messaging_product\": \"whatsapp\",\n \"to\": \"5511999999999\",\n \"type\": \"text\",\n \"recipient_type\": \"individual\",\n \"text\": {\n \"preview_url\": false,\n \"body\": \"Hello from Pilot Status 👋\"\n },\n \"image\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\",\n \"caption\": \"<string>\"\n },\n \"audio\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\"\n },\n \"video\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\",\n \"caption\": \"<string>\"\n },\n \"document\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\",\n \"caption\": \"<string>\",\n \"filename\": \"<string>\"\n },\n \"sticker\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\"\n },\n \"contacts\": [\n {}\n ],\n \"interactive\": {\n \"type\": \"<string>\",\n \"header\": {},\n \"body\": {\n \"text\": \"<string>\"\n },\n \"footer\": {\n \"text\": \"<string>\"\n },\n \"action\": {}\n },\n \"template\": {\n \"name\": \"<string>\",\n \"language\": {\n \"code\": \"<string>\"\n },\n \"components\": [\n {}\n ]\n },\n \"reaction\": {\n \"message_id\": \"<string>\",\n \"emoji\": \"<string>\"\n },\n \"context\": {\n \"message_id\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/api/layer/meta/{phoneNumberId}/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"messaging_product\": \"whatsapp\",\n \"to\": \"5511999999999\",\n \"type\": \"text\",\n \"recipient_type\": \"individual\",\n \"text\": {\n \"preview_url\": false,\n \"body\": \"Hello from Pilot Status 👋\"\n },\n \"image\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\",\n \"caption\": \"<string>\"\n },\n \"audio\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\"\n },\n \"video\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\",\n \"caption\": \"<string>\"\n },\n \"document\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\",\n \"caption\": \"<string>\",\n \"filename\": \"<string>\"\n },\n \"sticker\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\"\n },\n \"contacts\": [\n {}\n ],\n \"interactive\": {\n \"type\": \"<string>\",\n \"header\": {},\n \"body\": {\n \"text\": \"<string>\"\n },\n \"footer\": {\n \"text\": \"<string>\"\n },\n \"action\": {}\n },\n \"template\": {\n \"name\": \"<string>\",\n \"language\": {\n \"code\": \"<string>\"\n },\n \"components\": [\n {}\n ]\n },\n \"reaction\": {\n \"message_id\": \"<string>\",\n \"emoji\": \"<string>\"\n },\n \"context\": {\n \"message_id\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"messaging_product": "whatsapp",
"contacts": [
{
"input": "5511999999999",
"wa_id": "5511999999999"
}
],
"messages": [
{
"id": "wamid.HBgL..."
}
]
}{
"error": {
"message": "(#131030) Recipient phone number not in allowed list",
"type": "OAuthException",
"code": 131030,
"fbtrace_id": "A..."
}
}Authorizations
Your Pilot Status API key (ps_...). You may also send Authorization: Bearer ps_... or ?access_token=ps_....
Path Parameters
Meta phone-number id of the number linked to your API key.
Body
Always whatsapp.
whatsapp "whatsapp"
Recipient MSISDN (or group id).
"5511999999999"
Message kind — selects which object below to fill.
text, image, audio, video, document, sticker, location, contacts, interactive, template, reaction "text"
individual or group.
individual, group "individual"
Show child attributes
Show child attributes
{
"preview_url": false,
"body": "Hello from Pilot Status 👋"
}
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Contact cards.
Interactive message (buttons/list/CTA/flow).
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Quote/reply context.
Show child attributes
Show child attributes
Was this page helpful?
curl --request POST \
--url https://pilotstatus.com.br/api/layer/meta/{phoneNumberId}/messages \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"messaging_product": "whatsapp",
"to": "5511999999999",
"type": "text",
"recipient_type": "individual",
"text": {
"preview_url": false,
"body": "Hello from Pilot Status 👋"
},
"image": {
"id": "<string>",
"link": "<string>",
"caption": "<string>"
},
"audio": {
"id": "<string>",
"link": "<string>"
},
"video": {
"id": "<string>",
"link": "<string>",
"caption": "<string>"
},
"document": {
"id": "<string>",
"link": "<string>",
"caption": "<string>",
"filename": "<string>"
},
"sticker": {
"id": "<string>",
"link": "<string>"
},
"contacts": [
{}
],
"interactive": {
"type": "<string>",
"header": {},
"body": {
"text": "<string>"
},
"footer": {
"text": "<string>"
},
"action": {}
},
"template": {
"name": "<string>",
"language": {
"code": "<string>"
},
"components": [
{}
]
},
"reaction": {
"message_id": "<string>",
"emoji": "<string>"
},
"context": {
"message_id": "<string>"
}
}
'import requests
url = "https://pilotstatus.com.br/api/layer/meta/{phoneNumberId}/messages"
payload = {
"messaging_product": "whatsapp",
"to": "5511999999999",
"type": "text",
"recipient_type": "individual",
"text": {
"preview_url": False,
"body": "Hello from Pilot Status 👋"
},
"image": {
"id": "<string>",
"link": "<string>",
"caption": "<string>"
},
"audio": {
"id": "<string>",
"link": "<string>"
},
"video": {
"id": "<string>",
"link": "<string>",
"caption": "<string>"
},
"document": {
"id": "<string>",
"link": "<string>",
"caption": "<string>",
"filename": "<string>"
},
"sticker": {
"id": "<string>",
"link": "<string>"
},
"contacts": [{}],
"interactive": {
"type": "<string>",
"header": {},
"body": { "text": "<string>" },
"footer": { "text": "<string>" },
"action": {}
},
"template": {
"name": "<string>",
"language": { "code": "<string>" },
"components": [{}]
},
"reaction": {
"message_id": "<string>",
"emoji": "<string>"
},
"context": { "message_id": "<string>" }
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
messaging_product: 'whatsapp',
to: '5511999999999',
type: 'text',
recipient_type: 'individual',
text: {preview_url: false, body: JSON.stringify('Hello from Pilot Status 👋')},
image: {id: '<string>', link: '<string>', caption: '<string>'},
audio: {id: '<string>', link: '<string>'},
video: {id: '<string>', link: '<string>', caption: '<string>'},
document: {id: '<string>', link: '<string>', caption: '<string>', filename: '<string>'},
sticker: {id: '<string>', link: '<string>'},
contacts: [{}],
interactive: {
type: '<string>',
header: {},
body: JSON.stringify({text: '<string>'}),
footer: {text: '<string>'},
action: {}
},
template: {name: '<string>', language: {code: '<string>'}, components: [{}]},
reaction: {message_id: '<string>', emoji: '<string>'},
context: {message_id: '<string>'}
})
};
fetch('https://pilotstatus.com.br/api/layer/meta/{phoneNumberId}/messages', 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://pilotstatus.com.br/api/layer/meta/{phoneNumberId}/messages",
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([
'messaging_product' => 'whatsapp',
'to' => '5511999999999',
'type' => 'text',
'recipient_type' => 'individual',
'text' => [
'preview_url' => false,
'body' => 'Hello from Pilot Status 👋'
],
'image' => [
'id' => '<string>',
'link' => '<string>',
'caption' => '<string>'
],
'audio' => [
'id' => '<string>',
'link' => '<string>'
],
'video' => [
'id' => '<string>',
'link' => '<string>',
'caption' => '<string>'
],
'document' => [
'id' => '<string>',
'link' => '<string>',
'caption' => '<string>',
'filename' => '<string>'
],
'sticker' => [
'id' => '<string>',
'link' => '<string>'
],
'contacts' => [
[
]
],
'interactive' => [
'type' => '<string>',
'header' => [
],
'body' => [
'text' => '<string>'
],
'footer' => [
'text' => '<string>'
],
'action' => [
]
],
'template' => [
'name' => '<string>',
'language' => [
'code' => '<string>'
],
'components' => [
[
]
]
],
'reaction' => [
'message_id' => '<string>',
'emoji' => '<string>'
],
'context' => [
'message_id' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://pilotstatus.com.br/api/layer/meta/{phoneNumberId}/messages"
payload := strings.NewReader("{\n \"messaging_product\": \"whatsapp\",\n \"to\": \"5511999999999\",\n \"type\": \"text\",\n \"recipient_type\": \"individual\",\n \"text\": {\n \"preview_url\": false,\n \"body\": \"Hello from Pilot Status 👋\"\n },\n \"image\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\",\n \"caption\": \"<string>\"\n },\n \"audio\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\"\n },\n \"video\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\",\n \"caption\": \"<string>\"\n },\n \"document\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\",\n \"caption\": \"<string>\",\n \"filename\": \"<string>\"\n },\n \"sticker\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\"\n },\n \"contacts\": [\n {}\n ],\n \"interactive\": {\n \"type\": \"<string>\",\n \"header\": {},\n \"body\": {\n \"text\": \"<string>\"\n },\n \"footer\": {\n \"text\": \"<string>\"\n },\n \"action\": {}\n },\n \"template\": {\n \"name\": \"<string>\",\n \"language\": {\n \"code\": \"<string>\"\n },\n \"components\": [\n {}\n ]\n },\n \"reaction\": {\n \"message_id\": \"<string>\",\n \"emoji\": \"<string>\"\n },\n \"context\": {\n \"message_id\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://pilotstatus.com.br/api/layer/meta/{phoneNumberId}/messages")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"messaging_product\": \"whatsapp\",\n \"to\": \"5511999999999\",\n \"type\": \"text\",\n \"recipient_type\": \"individual\",\n \"text\": {\n \"preview_url\": false,\n \"body\": \"Hello from Pilot Status 👋\"\n },\n \"image\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\",\n \"caption\": \"<string>\"\n },\n \"audio\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\"\n },\n \"video\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\",\n \"caption\": \"<string>\"\n },\n \"document\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\",\n \"caption\": \"<string>\",\n \"filename\": \"<string>\"\n },\n \"sticker\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\"\n },\n \"contacts\": [\n {}\n ],\n \"interactive\": {\n \"type\": \"<string>\",\n \"header\": {},\n \"body\": {\n \"text\": \"<string>\"\n },\n \"footer\": {\n \"text\": \"<string>\"\n },\n \"action\": {}\n },\n \"template\": {\n \"name\": \"<string>\",\n \"language\": {\n \"code\": \"<string>\"\n },\n \"components\": [\n {}\n ]\n },\n \"reaction\": {\n \"message_id\": \"<string>\",\n \"emoji\": \"<string>\"\n },\n \"context\": {\n \"message_id\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/api/layer/meta/{phoneNumberId}/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"messaging_product\": \"whatsapp\",\n \"to\": \"5511999999999\",\n \"type\": \"text\",\n \"recipient_type\": \"individual\",\n \"text\": {\n \"preview_url\": false,\n \"body\": \"Hello from Pilot Status 👋\"\n },\n \"image\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\",\n \"caption\": \"<string>\"\n },\n \"audio\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\"\n },\n \"video\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\",\n \"caption\": \"<string>\"\n },\n \"document\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\",\n \"caption\": \"<string>\",\n \"filename\": \"<string>\"\n },\n \"sticker\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\"\n },\n \"contacts\": [\n {}\n ],\n \"interactive\": {\n \"type\": \"<string>\",\n \"header\": {},\n \"body\": {\n \"text\": \"<string>\"\n },\n \"footer\": {\n \"text\": \"<string>\"\n },\n \"action\": {}\n },\n \"template\": {\n \"name\": \"<string>\",\n \"language\": {\n \"code\": \"<string>\"\n },\n \"components\": [\n {}\n ]\n },\n \"reaction\": {\n \"message_id\": \"<string>\",\n \"emoji\": \"<string>\"\n },\n \"context\": {\n \"message_id\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"messaging_product": "whatsapp",
"contacts": [
{
"input": "5511999999999",
"wa_id": "5511999999999"
}
],
"messages": [
{
"id": "wamid.HBgL..."
}
]
}{
"error": {
"message": "(#131030) Recipient phone number not in allowed list",
"type": "OAuthException",
"code": 131030,
"fbtrace_id": "A..."
}
}