Messages
Send a WhatsApp message
Send a WhatsApp customer-channel message.
POST
/
meta
/
v22.0
/
{PHONE_NUMBER_ID}
/
messages
Send a WhatsApp message
curl --request POST \
--url https://gateway.hookmyapp.com/meta/v22.0/{PHONE_NUMBER_ID}/messages \
--header 'Content-Type: application/json' \
--data '
{
"messaging_product": "<string>",
"to": "<string>",
"type": "<string>"
}
'import requests
url = "https://gateway.hookmyapp.com/meta/v22.0/{PHONE_NUMBER_ID}/messages"
payload = {
"messaging_product": "<string>",
"to": "<string>",
"type": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({messaging_product: '<string>', to: '<string>', type: '<string>'})
};
fetch('https://gateway.hookmyapp.com/meta/v22.0/{PHONE_NUMBER_ID}/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://gateway.hookmyapp.com/meta/v22.0/{PHONE_NUMBER_ID}/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' => '<string>',
'to' => '<string>',
'type' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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://gateway.hookmyapp.com/meta/v22.0/{PHONE_NUMBER_ID}/messages"
payload := strings.NewReader("{\n \"messaging_product\": \"<string>\",\n \"to\": \"<string>\",\n \"type\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://gateway.hookmyapp.com/meta/v22.0/{PHONE_NUMBER_ID}/messages")
.header("Content-Type", "application/json")
.body("{\n \"messaging_product\": \"<string>\",\n \"to\": \"<string>\",\n \"type\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://gateway.hookmyapp.com/meta/v22.0/{PHONE_NUMBER_ID}/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"messaging_product\": \"<string>\",\n \"to\": \"<string>\",\n \"type\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodySend a WhatsApp message through one customer’s connected channel.
Use the HookMyApp channel ID (
ch_...) when you fetch the channel token. Use the WhatsApp phone number ID in the gateway path.
Authentication
Use the returnedhmat_ channel token to send the message. Do not use an hmok_ API key for the send call.
Authorization: Bearer hmat_...
Path parameters
string
required
The WhatsApp phone number ID for the customer channel, from
WHATSAPP_PHONE_NUMBER_ID.Request body
string
required
Always
whatsapp.string
required
Recipient phone number in international format.
string
required
Message type, such as
text, image, video, audio, document, sticker, location, contacts, interactive, template, or reaction.Example
curl -X POST "https://gateway.hookmyapp.com/meta/v22.0/{PHONE_NUMBER_ID}/messages" \
-H "Authorization: Bearer hmat_..." \
-H "Content-Type: application/json" \
-d '{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "15551234567",
"type": "text",
"text": { "body": "Hello! Your order #12345 has been shipped." }
}'
Successful response
{
"messaging_product": "whatsapp",
"contacts": [
{
"input": "15551234567",
"wa_id": "15551234567"
}
],
"messages": [
{
"id": "wamid.HBgNMTU1NTE0OTU5Nzg1FQIAERgSMDhGRjdBMDEyOTcxQzFFQkFBAA=="
}
]
}
⌘I
Send a WhatsApp message
curl --request POST \
--url https://gateway.hookmyapp.com/meta/v22.0/{PHONE_NUMBER_ID}/messages \
--header 'Content-Type: application/json' \
--data '
{
"messaging_product": "<string>",
"to": "<string>",
"type": "<string>"
}
'import requests
url = "https://gateway.hookmyapp.com/meta/v22.0/{PHONE_NUMBER_ID}/messages"
payload = {
"messaging_product": "<string>",
"to": "<string>",
"type": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({messaging_product: '<string>', to: '<string>', type: '<string>'})
};
fetch('https://gateway.hookmyapp.com/meta/v22.0/{PHONE_NUMBER_ID}/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://gateway.hookmyapp.com/meta/v22.0/{PHONE_NUMBER_ID}/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' => '<string>',
'to' => '<string>',
'type' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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://gateway.hookmyapp.com/meta/v22.0/{PHONE_NUMBER_ID}/messages"
payload := strings.NewReader("{\n \"messaging_product\": \"<string>\",\n \"to\": \"<string>\",\n \"type\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://gateway.hookmyapp.com/meta/v22.0/{PHONE_NUMBER_ID}/messages")
.header("Content-Type", "application/json")
.body("{\n \"messaging_product\": \"<string>\",\n \"to\": \"<string>\",\n \"type\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://gateway.hookmyapp.com/meta/v22.0/{PHONE_NUMBER_ID}/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"messaging_product\": \"<string>\",\n \"to\": \"<string>\",\n \"type\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body