Send a message, mark read, or send a typing indicator (Meta Cloud API-compatible)
curl --request POST \
--url https://api.polymorfa.com/{version}/{phoneNumberId}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messaging_product": "whatsapp",
"recipient_type": "<string>",
"to": "15551234567",
"text": {
"body": "<string>",
"preview_url": true
},
"image": {
"id": "<string>",
"link": "<string>",
"caption": "<string>",
"filename": "<string>",
"voice": true
},
"video": {
"id": "<string>",
"link": "<string>",
"caption": "<string>",
"filename": "<string>",
"voice": true
},
"document": {
"id": "<string>",
"link": "<string>",
"caption": "<string>",
"filename": "<string>",
"voice": true
},
"audio": {
"id": "<string>",
"link": "<string>",
"caption": "<string>",
"filename": "<string>",
"voice": true
},
"sticker": {
"id": "<string>",
"link": "<string>",
"caption": "<string>",
"filename": "<string>",
"voice": true
},
"location": {
"latitude": 123,
"longitude": 123,
"name": "<string>",
"address": "<string>"
},
"contacts": [
null
],
"reaction": {
"message_id": "<string>",
"emoji": "<string>"
},
"interactive": null,
"template": null,
"status": "read",
"message_id": "<string>",
"typing_indicator": null
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
messaging_product: 'whatsapp',
recipient_type: '<string>',
to: '15551234567',
text: {body: JSON.stringify('<string>'), preview_url: true},
image: {
id: '<string>',
link: '<string>',
caption: '<string>',
filename: '<string>',
voice: true
},
video: {
id: '<string>',
link: '<string>',
caption: '<string>',
filename: '<string>',
voice: true
},
document: {
id: '<string>',
link: '<string>',
caption: '<string>',
filename: '<string>',
voice: true
},
audio: {
id: '<string>',
link: '<string>',
caption: '<string>',
filename: '<string>',
voice: true
},
sticker: {
id: '<string>',
link: '<string>',
caption: '<string>',
filename: '<string>',
voice: true
},
location: {latitude: 123, longitude: 123, name: '<string>', address: '<string>'},
contacts: [null],
reaction: {message_id: '<string>', emoji: '<string>'},
interactive: null,
template: null,
status: 'read',
message_id: '<string>',
typing_indicator: null
})
};
fetch('https://api.polymorfa.com/{version}/{phoneNumberId}/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.polymorfa.com/{version}/{phoneNumberId}/messages"
payload = {
"messaging_product": "whatsapp",
"recipient_type": "<string>",
"to": "15551234567",
"text": {
"body": "<string>",
"preview_url": True
},
"image": {
"id": "<string>",
"link": "<string>",
"caption": "<string>",
"filename": "<string>",
"voice": True
},
"video": {
"id": "<string>",
"link": "<string>",
"caption": "<string>",
"filename": "<string>",
"voice": True
},
"document": {
"id": "<string>",
"link": "<string>",
"caption": "<string>",
"filename": "<string>",
"voice": True
},
"audio": {
"id": "<string>",
"link": "<string>",
"caption": "<string>",
"filename": "<string>",
"voice": True
},
"sticker": {
"id": "<string>",
"link": "<string>",
"caption": "<string>",
"filename": "<string>",
"voice": True
},
"location": {
"latitude": 123,
"longitude": 123,
"name": "<string>",
"address": "<string>"
},
"contacts": [None],
"reaction": {
"message_id": "<string>",
"emoji": "<string>"
},
"interactive": None,
"template": None,
"status": "read",
"message_id": "<string>",
"typing_indicator": None
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.polymorfa.com/{version}/{phoneNumberId}/messages"
payload := strings.NewReader("{\n \"messaging_product\": \"whatsapp\",\n \"recipient_type\": \"<string>\",\n \"to\": \"15551234567\",\n \"text\": {\n \"body\": \"<string>\",\n \"preview_url\": true\n },\n \"image\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\",\n \"caption\": \"<string>\",\n \"filename\": \"<string>\",\n \"voice\": true\n },\n \"video\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\",\n \"caption\": \"<string>\",\n \"filename\": \"<string>\",\n \"voice\": true\n },\n \"document\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\",\n \"caption\": \"<string>\",\n \"filename\": \"<string>\",\n \"voice\": true\n },\n \"audio\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\",\n \"caption\": \"<string>\",\n \"filename\": \"<string>\",\n \"voice\": true\n },\n \"sticker\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\",\n \"caption\": \"<string>\",\n \"filename\": \"<string>\",\n \"voice\": true\n },\n \"location\": {\n \"latitude\": 123,\n \"longitude\": 123,\n \"name\": \"<string>\",\n \"address\": \"<string>\"\n },\n \"contacts\": [\n null\n ],\n \"reaction\": {\n \"message_id\": \"<string>\",\n \"emoji\": \"<string>\"\n },\n \"interactive\": null,\n \"template\": null,\n \"status\": \"read\",\n \"message_id\": \"<string>\",\n \"typing_indicator\": null\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))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.polymorfa.com/{version}/{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',
'recipient_type' => '<string>',
'to' => '15551234567',
'text' => [
'body' => '<string>',
'preview_url' => true
],
'image' => [
'id' => '<string>',
'link' => '<string>',
'caption' => '<string>',
'filename' => '<string>',
'voice' => true
],
'video' => [
'id' => '<string>',
'link' => '<string>',
'caption' => '<string>',
'filename' => '<string>',
'voice' => true
],
'document' => [
'id' => '<string>',
'link' => '<string>',
'caption' => '<string>',
'filename' => '<string>',
'voice' => true
],
'audio' => [
'id' => '<string>',
'link' => '<string>',
'caption' => '<string>',
'filename' => '<string>',
'voice' => true
],
'sticker' => [
'id' => '<string>',
'link' => '<string>',
'caption' => '<string>',
'filename' => '<string>',
'voice' => true
],
'location' => [
'latitude' => 123,
'longitude' => 123,
'name' => '<string>',
'address' => '<string>'
],
'contacts' => [
null
],
'reaction' => [
'message_id' => '<string>',
'emoji' => '<string>'
],
'interactive' => null,
'template' => null,
'status' => 'read',
'message_id' => '<string>',
'typing_indicator' => null
]),
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;
}{
"messaging_product": "whatsapp",
"contacts": [
{
"input": "<string>",
"wa_id": "<string>"
}
],
"messages": [
{
"id": "<string>"
}
]
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": 123,
"fbtrace_id": "<string>",
"error_subcode": 123,
"error_data": null
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": 123,
"fbtrace_id": "<string>",
"error_subcode": 123,
"error_data": null
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": 123,
"fbtrace_id": "<string>",
"error_subcode": 123,
"error_data": null
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": 123,
"fbtrace_id": "<string>",
"error_subcode": 123,
"error_data": null
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": 123,
"fbtrace_id": "<string>",
"error_subcode": 123,
"error_data": null
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": 123,
"fbtrace_id": "<string>",
"error_subcode": 123,
"error_data": null
}
}Graph API
Send a message, mark read, or send a typing indicator (Meta Cloud API-compatible)
Protocols: Linked Device API · Meta Cloud API · Polymorfa Hybrid Link
POST
/
{version}
/
{phoneNumberId}
/
messages
Send a message, mark read, or send a typing indicator (Meta Cloud API-compatible)
curl --request POST \
--url https://api.polymorfa.com/{version}/{phoneNumberId}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messaging_product": "whatsapp",
"recipient_type": "<string>",
"to": "15551234567",
"text": {
"body": "<string>",
"preview_url": true
},
"image": {
"id": "<string>",
"link": "<string>",
"caption": "<string>",
"filename": "<string>",
"voice": true
},
"video": {
"id": "<string>",
"link": "<string>",
"caption": "<string>",
"filename": "<string>",
"voice": true
},
"document": {
"id": "<string>",
"link": "<string>",
"caption": "<string>",
"filename": "<string>",
"voice": true
},
"audio": {
"id": "<string>",
"link": "<string>",
"caption": "<string>",
"filename": "<string>",
"voice": true
},
"sticker": {
"id": "<string>",
"link": "<string>",
"caption": "<string>",
"filename": "<string>",
"voice": true
},
"location": {
"latitude": 123,
"longitude": 123,
"name": "<string>",
"address": "<string>"
},
"contacts": [
null
],
"reaction": {
"message_id": "<string>",
"emoji": "<string>"
},
"interactive": null,
"template": null,
"status": "read",
"message_id": "<string>",
"typing_indicator": null
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
messaging_product: 'whatsapp',
recipient_type: '<string>',
to: '15551234567',
text: {body: JSON.stringify('<string>'), preview_url: true},
image: {
id: '<string>',
link: '<string>',
caption: '<string>',
filename: '<string>',
voice: true
},
video: {
id: '<string>',
link: '<string>',
caption: '<string>',
filename: '<string>',
voice: true
},
document: {
id: '<string>',
link: '<string>',
caption: '<string>',
filename: '<string>',
voice: true
},
audio: {
id: '<string>',
link: '<string>',
caption: '<string>',
filename: '<string>',
voice: true
},
sticker: {
id: '<string>',
link: '<string>',
caption: '<string>',
filename: '<string>',
voice: true
},
location: {latitude: 123, longitude: 123, name: '<string>', address: '<string>'},
contacts: [null],
reaction: {message_id: '<string>', emoji: '<string>'},
interactive: null,
template: null,
status: 'read',
message_id: '<string>',
typing_indicator: null
})
};
fetch('https://api.polymorfa.com/{version}/{phoneNumberId}/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.polymorfa.com/{version}/{phoneNumberId}/messages"
payload = {
"messaging_product": "whatsapp",
"recipient_type": "<string>",
"to": "15551234567",
"text": {
"body": "<string>",
"preview_url": True
},
"image": {
"id": "<string>",
"link": "<string>",
"caption": "<string>",
"filename": "<string>",
"voice": True
},
"video": {
"id": "<string>",
"link": "<string>",
"caption": "<string>",
"filename": "<string>",
"voice": True
},
"document": {
"id": "<string>",
"link": "<string>",
"caption": "<string>",
"filename": "<string>",
"voice": True
},
"audio": {
"id": "<string>",
"link": "<string>",
"caption": "<string>",
"filename": "<string>",
"voice": True
},
"sticker": {
"id": "<string>",
"link": "<string>",
"caption": "<string>",
"filename": "<string>",
"voice": True
},
"location": {
"latitude": 123,
"longitude": 123,
"name": "<string>",
"address": "<string>"
},
"contacts": [None],
"reaction": {
"message_id": "<string>",
"emoji": "<string>"
},
"interactive": None,
"template": None,
"status": "read",
"message_id": "<string>",
"typing_indicator": None
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.polymorfa.com/{version}/{phoneNumberId}/messages"
payload := strings.NewReader("{\n \"messaging_product\": \"whatsapp\",\n \"recipient_type\": \"<string>\",\n \"to\": \"15551234567\",\n \"text\": {\n \"body\": \"<string>\",\n \"preview_url\": true\n },\n \"image\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\",\n \"caption\": \"<string>\",\n \"filename\": \"<string>\",\n \"voice\": true\n },\n \"video\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\",\n \"caption\": \"<string>\",\n \"filename\": \"<string>\",\n \"voice\": true\n },\n \"document\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\",\n \"caption\": \"<string>\",\n \"filename\": \"<string>\",\n \"voice\": true\n },\n \"audio\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\",\n \"caption\": \"<string>\",\n \"filename\": \"<string>\",\n \"voice\": true\n },\n \"sticker\": {\n \"id\": \"<string>\",\n \"link\": \"<string>\",\n \"caption\": \"<string>\",\n \"filename\": \"<string>\",\n \"voice\": true\n },\n \"location\": {\n \"latitude\": 123,\n \"longitude\": 123,\n \"name\": \"<string>\",\n \"address\": \"<string>\"\n },\n \"contacts\": [\n null\n ],\n \"reaction\": {\n \"message_id\": \"<string>\",\n \"emoji\": \"<string>\"\n },\n \"interactive\": null,\n \"template\": null,\n \"status\": \"read\",\n \"message_id\": \"<string>\",\n \"typing_indicator\": null\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))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.polymorfa.com/{version}/{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',
'recipient_type' => '<string>',
'to' => '15551234567',
'text' => [
'body' => '<string>',
'preview_url' => true
],
'image' => [
'id' => '<string>',
'link' => '<string>',
'caption' => '<string>',
'filename' => '<string>',
'voice' => true
],
'video' => [
'id' => '<string>',
'link' => '<string>',
'caption' => '<string>',
'filename' => '<string>',
'voice' => true
],
'document' => [
'id' => '<string>',
'link' => '<string>',
'caption' => '<string>',
'filename' => '<string>',
'voice' => true
],
'audio' => [
'id' => '<string>',
'link' => '<string>',
'caption' => '<string>',
'filename' => '<string>',
'voice' => true
],
'sticker' => [
'id' => '<string>',
'link' => '<string>',
'caption' => '<string>',
'filename' => '<string>',
'voice' => true
],
'location' => [
'latitude' => 123,
'longitude' => 123,
'name' => '<string>',
'address' => '<string>'
],
'contacts' => [
null
],
'reaction' => [
'message_id' => '<string>',
'emoji' => '<string>'
],
'interactive' => null,
'template' => null,
'status' => 'read',
'message_id' => '<string>',
'typing_indicator' => null
]),
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;
}{
"messaging_product": "whatsapp",
"contacts": [
{
"input": "<string>",
"wa_id": "<string>"
}
],
"messages": [
{
"id": "<string>"
}
]
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": 123,
"fbtrace_id": "<string>",
"error_subcode": 123,
"error_data": null
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": 123,
"fbtrace_id": "<string>",
"error_subcode": 123,
"error_data": null
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": 123,
"fbtrace_id": "<string>",
"error_subcode": 123,
"error_data": null
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": 123,
"fbtrace_id": "<string>",
"error_subcode": 123,
"error_data": null
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": 123,
"fbtrace_id": "<string>",
"error_subcode": 123,
"error_data": null
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": 123,
"fbtrace_id": "<string>",
"error_subcode": 123,
"error_data": null
}
}Linked Device API
Meta Cloud API
Polymorfa Hybrid Link
Authorizations
Polymorfa organization key (titan_ prefix) or project token (titan_pt_ prefix). Client tokens are not accepted by Graph operations.
Path Parameters
Example:
"v21.0"
Example:
"123456789012345"
Body
application/json
Example:
"whatsapp"
Example:
"15551234567"
Available options:
text, image, video, document, audio, sticker, location, contacts, reaction, interactive, template 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
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Example:
"read"