POST /messages/send
After 24h without a reply from the customer, it is not possible to send regular messages, you'll need to use a Template message, see examples below.
Required Parameters
Parameter | Type | Description |
---|---|---|
to | String | Phone number or platform identifier |
from | String | Channel identifier (e.g. whatsapp ) |
type | MessageType | Type of message to be sent |
content | MessageContent | Content of the message |
Optional Parameters
Parameter | Type | Description |
---|---|---|
template_uuid | string | Unique identifier of the template message |
optin_contact | Boolean | Confirmation that the contact has opted-in for receiving messages |
Example Request
- cURL
- Node
- Ruby
- Go
- PHP
- Python
curl -X POST "https://api.callbell.eu/v1/messages/send" \
-H "Authorization: Bearer test_gshuPaZoeEG6ovbc8M79w0QyM" \
-H "Content-Type: application/json" \
-d '{
"to": "+31612345678",
"from": "whatsapp",
"type": "text",
"content": {
"text": "Hello!"
}
}'
const axios = require('axios');
const response = await axios.post(
'https://api.callbell.eu/v1/messages/send',
// '{\n "to": "+31612345678",\n "from": "whatsapp",\n "type": "text",\n "content": {\n "text": "Hello!"\n }\n }',
{
'to': '+31612345678',
'from': 'whatsapp',
'type': 'text',
'content': {
'text': 'Hello!'
}
},
{
headers: {
'Authorization': 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type': 'application/json'
}
}
);
require 'net/http'
require 'json'
uri = URI('https://api.callbell.eu/v1/messages/send')
req = Net::HTTP::Post.new(uri)
req.content_type = 'application/json'
req['Authorization'] = 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM'
# The object won't be serialized exactly like this
# req.body = "{\n \"to\": \"+31612345678\",\n \"from\": \"whatsapp\",\n \"type\": \"text\",\n \"content\": {\n \"text\": \"Hello!\"\n }\n }"
req.body = {
'to' => '+31612345678',
'from' => 'whatsapp',
'type' => 'text',
'content' => {
'text' => 'Hello!'
}
}.to_json
req_options = {
use_ssl: uri.scheme == 'https'
}
res = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(req)
end
package main
import (
"fmt"
"io"
"log"
"net/http"
"strings"
)
func main() {
client := &http.Client{}
var data = strings.NewReader(`{
"to": "+31612345678",
"from": "whatsapp",
"type": "text",
"content": {
"text": "Hello!"
}
}`)
req, err := http.NewRequest("POST", "https://api.callbell.eu/v1/messages/send", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer test_gshuPaZoeEG6ovbc8M79w0QyM")
req.Header.Set("Content-Type", "application/json")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
bodyText, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)
}
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.callbell.eu/v1/messages/send');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\n \"to\": \"+31612345678\",\n \"from\": \"whatsapp\",\n \"type\": \"text\",\n \"content\": {\n \"text\": \"Hello!\"\n }\n }");
$response = curl_exec($ch);
curl_close($ch);
import requests
headers = {
'Authorization': 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type': 'application/json',
}
json_data = {
'to': '+31612345678',
'from': 'whatsapp',
'type': 'text',
'content': {
'text': 'Hello!',
},
}
response = requests.post('https://api.callbell.eu/v1/messages/send', headers=headers, json=json_data)
# Note: json_data will not be serialized by requests
# exactly as it was in the original request.
#data = '{\n "to": "+31612345678",\n "from": "whatsapp",\n "type": "text",\n "content": {\n "text": "Hello!"\n }\n }'
#response = requests.post('https://api.callbell.eu/v1/messages/send', headers=headers, data=data)
Response
Parameter | Type | Description |
---|---|---|
message | MessageSendRequest | The message send request. The system will initially enqueue the message. |
Example Response
{
"message": {
"uuid": "adf3d1216d4c4dcd908199d6700f2381",
"status": "enqueued"
}
}
Send Message with Media Attachments
You can use the API to send media messages containing images, documents, audio and video messages.
Is it also possible to add a caption when sending image
attachments (see the example request below).
Send Image Attachment Example
- cURL
- Node
- Ruby
- Go
- PHP
- Python
curl -X POST "https://api.callbell.eu/v1/messages/send" \
-H "Authorization: Bearer test_gshuPaZoeEG6ovbc8M79w0QyM" \
-H "Content-Type: application/json" \
-d '{
"to": "+31612345678",
"from": "whatsapp",
"type": "image",
"content": {
"url": "https://example.com/my_image.jpeg"
}
}'
const axios = require('axios');
const response = await axios.post(
'https://api.callbell.eu/v1/messages/send',
// '{\n "to": "+31612345678",\n "from": "whatsapp",\n "type": "image",\n "content": {\n "url": "https://example.com/my_image.jpeg"\n }\n }',
{
'to': '+31612345678',
'from': 'whatsapp',
'type': 'image',
'content': {
'url': 'https://example.com/my_image.jpeg'
}
},
{
headers: {
'Authorization': 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type': 'application/json'
}
}
);
require 'net/http'
require 'json'
uri = URI('https://api.callbell.eu/v1/messages/send')
req = Net::HTTP::Post.new(uri)
req.content_type = 'application/json'
req['Authorization'] = 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM'
# The object won't be serialized exactly like this
# req.body = "{\n \"to\": \"+31612345678\",\n \"from\": \"whatsapp\",\n \"type\": \"image\",\n \"content\": {\n \"url\": \"https://example.com/my_image.jpeg\"\n }\n }"
req.body = {
'to' => '+31612345678',
'from' => 'whatsapp',
'type' => 'image',
'content' => {
'url' => 'https://example.com/my_image.jpeg'
}
}.to_json
req_options = {
use_ssl: uri.scheme == 'https'
}
res = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(req)
end
package main
import (
"fmt"
"io"
"log"
"net/http"
"strings"
)
func main() {
client := &http.Client{}
var data = strings.NewReader(`{
"to": "+31612345678",
"from": "whatsapp",
"type": "image",
"content": {
"url": "https://example.com/my_image.jpeg"
}
}`)
req, err := http.NewRequest("POST", "https://api.callbell.eu/v1/messages/send", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer test_gshuPaZoeEG6ovbc8M79w0QyM")
req.Header.Set("Content-Type", "application/json")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
bodyText, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)
}
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.callbell.eu/v1/messages/send');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\n \"to\": \"+31612345678\",\n \"from\": \"whatsapp\",\n \"type\": \"image\",\n \"content\": {\n \"url\": \"https://example.com/my_image.jpeg\"\n }\n }");
$response = curl_exec($ch);
curl_close($ch);
import requests
headers = {
'Authorization': 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type': 'application/json',
}
json_data = {
'to': '+31612345678',
'from': 'whatsapp',
'type': 'image',
'content': {
'url': 'https://example.com/my_image.jpeg',
},
}
response = requests.post('https://api.callbell.eu/v1/messages/send', headers=headers, json=json_data)
# Note: json_data will not be serialized by requests
# exactly as it was in the original request.
#data = '{\n "to": "+31612345678",\n "from": "whatsapp",\n "type": "image",\n "content": {\n "url": "https://example.com/my_image.jpeg"\n }\n }'
#response = requests.post('https://api.callbell.eu/v1/messages/send', headers=headers, data=data)
Send Image Attachment & Caption Example
- cURL
- Node
- Ruby
- Go
- PHP
- Python
curl -X POST "https://api.callbell.eu/v1/messages/send" \
-H "Authorization: Bearer test_gshuPaZoeEG6ovbc8M79w0QyM" \
-H "Content-Type: application/json" \
-d '{
"to": "+31612345678",
"from": "whatsapp",
"type": "image",
"content": {
"url": "https://example.com/my_image.jpeg",
"text: "This is my caption"
}
}'
const axios = require('axios');
const response = await axios.post(
'https://api.callbell.eu/v1/messages/send',
'{\n "to": "+31612345678",\n "from": "whatsapp",\n "type": "image",\n "content": {\n "url": "https://example.com/my_image.jpeg",\n "text: "This is my caption"\n }\n }',
{
headers: {
'Authorization': 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type': 'application/json'
}
}
);
require 'net/http'
uri = URI('https://api.callbell.eu/v1/messages/send')
req = Net::HTTP::Post.new(uri)
req.content_type = 'application/json'
req['Authorization'] = 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM'
req.body = "{\n \"to\": \"+31612345678\",\n \"from\": \"whatsapp\",\n \"type\": \"image\",\n \"content\": {\n \"url\": \"https://example.com/my_image.jpeg\",\n \"text: \"This is my caption\"\n }\n }"
req_options = {
use_ssl: uri.scheme == 'https'
}
res = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(req)
end
package main
import (
"fmt"
"io"
"log"
"net/http"
"strings"
)
func main() {
client := &http.Client{}
var data = strings.NewReader(`{
"to": "+31612345678",
"from": "whatsapp",
"type": "image",
"content": {
"url": "https://example.com/my_image.jpeg",
"text: "This is my caption"
}
}`)
req, err := http.NewRequest("POST", "https://api.callbell.eu/v1/messages/send", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer test_gshuPaZoeEG6ovbc8M79w0QyM")
req.Header.Set("Content-Type", "application/json")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
bodyText, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)
}
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.callbell.eu/v1/messages/send');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\n \"to\": \"+31612345678\",\n \"from\": \"whatsapp\",\n \"type\": \"image\",\n \"content\": {\n \"url\": \"https://example.com/my_image.jpeg\",\n \"text: \"This is my caption\"\n }\n }");
$response = curl_exec($ch);
curl_close($ch);
import requests
headers = {
'Authorization': 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type': 'application/json',
}
data = '{\n "to": "+31612345678",\n "from": "whatsapp",\n "type": "image",\n "content": {\n "url": "https://example.com/my_image.jpeg",\n "text: "This is my caption"\n }\n }'
response = requests.post('https://api.callbell.eu/v1/messages/send', headers=headers, data=data)
Send Document Attachment Example
- cURL
- Node
- Ruby
- Go
- PHP
- Python
curl -X POST "https://api.callbell.eu/v1/messages/send" \
-H "Authorization: Bearer test_gshuPaZoeEG6ovbc8M79w0QyM" \
-H "Content-Type: application/json" \
-d '{
"to": "+31612345678",
"from": "whatsapp",
"type": "document",
"content": {
"url": "https://example.com/my_image.pdf"
}
}'
const axios = require('axios');
const response = await axios.post(
'https://api.callbell.eu/v1/messages/send',
// '{\n "to": "+31612345678",\n "from": "whatsapp",\n "type": "document",\n "content": {\n "url": "https://example.com/my_image.pdf"\n }\n }',
{
'to': '+31612345678',
'from': 'whatsapp',
'type': 'document',
'content': {
'url': 'https://example.com/my_image.pdf'
}
},
{
headers: {
'Authorization': 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type': 'application/json'
}
}
);
require 'net/http'
require 'json'
uri = URI('https://api.callbell.eu/v1/messages/send')
req = Net::HTTP::Post.new(uri)
req.content_type = 'application/json'
req['Authorization'] = 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM'
# The object won't be serialized exactly like this
# req.body = "{\n \"to\": \"+31612345678\",\n \"from\": \"whatsapp\",\n \"type\": \"document\",\n \"content\": {\n \"url\": \"https://example.com/my_image.pdf\"\n }\n }"
req.body = {
'to' => '+31612345678',
'from' => 'whatsapp',
'type' => 'document',
'content' => {
'url' => 'https://example.com/my_image.pdf'
}
}.to_json
req_options = {
use_ssl: uri.scheme == 'https'
}
res = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(req)
end
package main
import (
"fmt"
"io"
"log"
"net/http"
"strings"
)
func main() {
client := &http.Client{}
var data = strings.NewReader(`{
"to": "+31612345678",
"from": "whatsapp",
"type": "document",
"content": {
"url": "https://example.com/my_image.pdf"
}
}`)
req, err := http.NewRequest("POST", "https://api.callbell.eu/v1/messages/send", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer test_gshuPaZoeEG6ovbc8M79w0QyM")
req.Header.Set("Content-Type", "application/json")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
bodyText, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)
}
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.callbell.eu/v1/messages/send');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\n \"to\": \"+31612345678\",\n \"from\": \"whatsapp\",\n \"type\": \"document\",\n \"content\": {\n \"url\": \"https://example.com/my_image.pdf\"\n }\n }");
$response = curl_exec($ch);
curl_close($ch);
import requests
headers = {
'Authorization': 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type': 'application/json',
}
json_data = {
'to': '+31612345678',
'from': 'whatsapp',
'type': 'document',
'content': {
'url': 'https://example.com/my_image.pdf',
},
}
response = requests.post('https://api.callbell.eu/v1/messages/send', headers=headers, json=json_data)
# Note: json_data will not be serialized by requests
# exactly as it was in the original request.
#data = '{\n "to": "+31612345678",\n "from": "whatsapp",\n "type": "document",\n "content": {\n "url": "https://example.com/my_image.pdf"\n }\n }'
#response = requests.post('https://api.callbell.eu/v1/messages/send', headers=headers, data=data)
Send Audio Attachment Example
This is only available for accounts using the official WhatsApp Business API integration.
- cURL
- Node
- Ruby
- Go
- PHP
- Python
curl -X POST "https://api.callbell.eu/v1/messages/send" \
-H "Authorization: Bearer test_gshuPaZoeEG6ovbc8M79w0QyM" \
-H "Content-Type: application/json" \
-d '{
"to": "+31612345678",
"from": "whatsapp",
"type": "document",
"content": {
"url": "https://example.com/my_audio.mp3"
}
}'
const axios = require('axios');
const response = await axios.post(
'https://api.callbell.eu/v1/messages/send',
// '{\n "to": "+31612345678",\n "from": "whatsapp",\n "type": "document",\n "content": {\n "url": "https://example.com/my_audio.mp3"\n }\n }',
{
'to': '+31612345678',
'from': 'whatsapp',
'type': 'document',
'content': {
'url': 'https://example.com/my_audio.mp3'
}
},
{
headers: {
'Authorization': 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type': 'application/json'
}
}
);
require 'net/http'
require 'json'
uri = URI('https://api.callbell.eu/v1/messages/send')
req = Net::HTTP::Post.new(uri)
req.content_type = 'application/json'
req['Authorization'] = 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM'
# The object won't be serialized exactly like this
# req.body = "{\n \"to\": \"+31612345678\",\n \"from\": \"whatsapp\",\n \"type\": \"document\",\n \"content\": {\n \"url\": \"https://example.com/my_audio.mp3\"\n }\n }"
req.body = {
'to' => '+31612345678',
'from' => 'whatsapp',
'type' => 'document',
'content' => {
'url' => 'https://example.com/my_audio.mp3'
}
}.to_json
req_options = {
use_ssl: uri.scheme == 'https'
}
res = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(req)
end
package main
import (
"fmt"
"io"
"log"
"net/http"
"strings"
)
func main() {
client := &http.Client{}
var data = strings.NewReader(`{
"to": "+31612345678",
"from": "whatsapp",
"type": "document",
"content": {
"url": "https://example.com/my_audio.mp3"
}
}`)
req, err := http.NewRequest("POST", "https://api.callbell.eu/v1/messages/send", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer test_gshuPaZoeEG6ovbc8M79w0QyM")
req.Header.Set("Content-Type", "application/json")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
bodyText, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)
}
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.callbell.eu/v1/messages/send');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\n \"to\": \"+31612345678\",\n \"from\": \"whatsapp\",\n \"type\": \"document\",\n \"content\": {\n \"url\": \"https://example.com/my_audio.mp3\"\n }\n }");
$response = curl_exec($ch);
curl_close($ch);
import requests
headers = {
'Authorization': 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type': 'application/json',
}
json_data = {
'to': '+31612345678',
'from': 'whatsapp',
'type': 'document',
'content': {
'url': 'https://example.com/my_audio.mp3',
},
}
response = requests.post('https://api.callbell.eu/v1/messages/send', headers=headers, json=json_data)
# Note: json_data will not be serialized by requests
# exactly as it was in the original request.
#data = '{\n "to": "+31612345678",\n "from": "whatsapp",\n "type": "document",\n "content": {\n "url": "https://example.com/my_audio.mp3"\n }\n }'
#response = requests.post('https://api.callbell.eu/v1/messages/send', headers=headers, data=data)
Send Video Attachment Example
This is only available for accounts using the official WhatsApp Business API integration.
- cURL
- Node
- Ruby
- Go
- PHP
- Python
curl -X POST "https://api.callbell.eu/v1/messages/send" \
-H "Authorization: Bearer test_gshuPaZoeEG6ovbc8M79w0QyM" \
-H "Content-Type: application/json" \
-d '{
"to": "+31612345678",
"from": "whatsapp",
"type": "document",
"content": {
"url": "https://example.com/my_video.mp4"
}
}'
const axios = require('axios');
const response = await axios.post(
'https://api.callbell.eu/v1/messages/send',
// '{\n "to": "+31612345678",\n "from": "whatsapp",\n "type": "document",\n "content": {\n "url": "https://example.com/my_video.mp4"\n }\n }',
{
'to': '+31612345678',
'from': 'whatsapp',
'type': 'document',
'content': {
'url': 'https://example.com/my_video.mp4'
}
},
{
headers: {
'Authorization': 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type': 'application/json'
}
}
);
require 'net/http'
require 'json'
uri = URI('https://api.callbell.eu/v1/messages/send')
req = Net::HTTP::Post.new(uri)
req.content_type = 'application/json'
req['Authorization'] = 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM'
# The object won't be serialized exactly like this
# req.body = "{\n \"to\": \"+31612345678\",\n \"from\": \"whatsapp\",\n \"type\": \"document\",\n \"content\": {\n \"url\": \"https://example.com/my_video.mp4\"\n }\n }"
req.body = {
'to' => '+31612345678',
'from' => 'whatsapp',
'type' => 'document',
'content' => {
'url' => 'https://example.com/my_video.mp4'
}
}.to_json
req_options = {
use_ssl: uri.scheme == 'https'
}
res = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(req)
end
package main
import (
"fmt"
"io"
"log"
"net/http"
"strings"
)
func main() {
client := &http.Client{}
var data = strings.NewReader(`{
"to": "+31612345678",
"from": "whatsapp",
"type": "document",
"content": {
"url": "https://example.com/my_video.mp4"
}
}`)
req, err := http.NewRequest("POST", "https://api.callbell.eu/v1/messages/send", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer test_gshuPaZoeEG6ovbc8M79w0QyM")
req.Header.Set("Content-Type", "application/json")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
bodyText, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)
}
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.callbell.eu/v1/messages/send');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\n \"to\": \"+31612345678\",\n \"from\": \"whatsapp\",\n \"type\": \"document\",\n \"content\": {\n \"url\": \"https://example.com/my_video.mp4\"\n }\n }");
$response = curl_exec($ch);
curl_close($ch);
import requests
headers = {
'Authorization': 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type': 'application/json',
}
json_data = {
'to': '+31612345678',
'from': 'whatsapp',
'type': 'document',
'content': {
'url': 'https://example.com/my_video.mp4',
},
}
response = requests.post('https://api.callbell.eu/v1/messages/send', headers=headers, json=json_data)
# Note: json_data will not be serialized by requests
# exactly as it was in the original request.
#data = '{\n "to": "+31612345678",\n "from": "whatsapp",\n "type": "document",\n "content": {\n "url": "https://example.com/my_video.mp4"\n }\n }'
#response = requests.post('https://api.callbell.eu/v1/messages/send', headers=headers, data=data)
Send Template Messages
You can use the API to send an approved Template Message.
This is only available for accounts using the official WhatsApp Business API integration.
In order to send template messages template_uuid
and optin_contact
must be present in the payload.
- cURL
- Node
- Ruby
- Go
- PHP
- Python
curl -X POST "https://api.callbell.eu/v1/messages/send" \
-H "Authorization: Bearer test_gshuPaZoeEG6ovbc8M79w0QyM" \
-H "Content-Type: application/json" \
-d '{
"to": "+31612345678",
"from": "whatsapp",
"type": "text",
"content": {
"text": "John Doe"
},
"template_uuid": "d980fb66fd5043d3ace1aa06ba044342",
"optin_contact": true
}'
const axios = require('axios');
const response = await axios.post(
'https://api.callbell.eu/v1/messages/send',
// '{\n "to": "+31612345678",\n "from": "whatsapp",\n "type": "text",\n "content": {\n "text": "John Doe"\n },\n "template_uuid": "d980fb66fd5043d3ace1aa06ba044342",\n "optin_contact": true\n }',
{
'to': '+31612345678',
'from': 'whatsapp',
'type': 'text',
'content': {
'text': 'John Doe'
},
'template_uuid': 'd980fb66fd5043d3ace1aa06ba044342',
'optin_contact': true
},
{
headers: {
'Authorization': 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type': 'application/json'
}
}
);
require 'net/http'
require 'json'
uri = URI('https://api.callbell.eu/v1/messages/send')
req = Net::HTTP::Post.new(uri)
req.content_type = 'application/json'
req['Authorization'] = 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM'
# The object won't be serialized exactly like this
# req.body = "{\n \"to\": \"+31612345678\",\n \"from\": \"whatsapp\",\n \"type\": \"text\",\n \"content\": {\n \"text\": \"John Doe\"\n },\n \"template_uuid\": \"d980fb66fd5043d3ace1aa06ba044342\",\n \"optin_contact\": true\n }"
req.body = {
'to' => '+31612345678',
'from' => 'whatsapp',
'type' => 'text',
'content' => {
'text' => 'John Doe'
},
'template_uuid' => 'd980fb66fd5043d3ace1aa06ba044342',
'optin_contact' => true
}.to_json
req_options = {
use_ssl: uri.scheme == 'https'
}
res = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(req)
end
package main
import (
"fmt"
"io"
"log"
"net/http"
"strings"
)
func main() {
client := &http.Client{}
var data = strings.NewReader(`{
"to": "+31612345678",
"from": "whatsapp",
"type": "text",
"content": {
"text": "John Doe"
},
"template_uuid": "d980fb66fd5043d3ace1aa06ba044342",
"optin_contact": true
}`)
req, err := http.NewRequest("POST", "https://api.callbell.eu/v1/messages/send", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer test_gshuPaZoeEG6ovbc8M79w0QyM")
req.Header.Set("Content-Type", "application/json")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
bodyText, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)
}
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.callbell.eu/v1/messages/send');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\n \"to\": \"+31612345678\",\n \"from\": \"whatsapp\",\n \"type\": \"text\",\n \"content\": {\n \"text\": \"John Doe\"\n },\n \"template_uuid\": \"d980fb66fd5043d3ace1aa06ba044342\",\n \"optin_contact\": true\n }");
$response = curl_exec($ch);
curl_close($ch);
import requests
headers = {
'Authorization': 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type': 'application/json',
}
json_data = {
'to': '+31612345678',
'from': 'whatsapp',
'type': 'text',
'content': {
'text': 'John Doe',
},
'template_uuid': 'd980fb66fd5043d3ace1aa06ba044342',
'optin_contact': True,
}
response = requests.post('https://api.callbell.eu/v1/messages/send', headers=headers, json=json_data)
# Note: json_data will not be serialized by requests
# exactly as it was in the original request.
#data = '{\n "to": "+31612345678",\n "from": "whatsapp",\n "type": "text",\n "content": {\n "text": "John Doe"\n },\n "template_uuid": "d980fb66fd5043d3ace1aa06ba044342",\n "optin_contact": true\n }'
#response = requests.post('https://api.callbell.eu/v1/messages/send', headers=headers, data=data)
In this context text
refers to the placeholder of the template message, for example let's say you have a template message like this:
Hello {{1}}, this is a template message example
The placeholder replacement will be done with the value passed in the payload, so in this case it will be the following:
Hello John Doe, this is a template message example
Send Template Messages with Media Attachments
You can use the API to send an approved Template Message
This is only available for accounts using the official WhatsApp Business API integration.
In order to send template messages template_uuid
and optin_contact
must be present in the payload.
If you have media template messages approved, you can send them by including a valid url
of the media
Send Image Attachment
- cURL
- Node
- Ruby
- Go
- PHP
- Python
curl -X POST "https://api.callbell.eu/v1/messages/send" \
-H "Authorization: Bearer test_gshuPaZoeEG6ovbc8M79w0QyM" \
-H "Content-Type: application/json" \
-d '{
"to": "+31612345678",
"from": "whatsapp",
"type": "image",
"content": {
"text": "John Doe",
"url": "https://example.com/valid_image.jpeg"
},
"template_uuid": "d980fb66fd5043d3ace1aa06ba044342",
"optin_contact": true
}'
const axios = require('axios');
const response = await axios.post(
'https://api.callbell.eu/v1/messages/send',
// '{\n "to": "+31612345678",\n "from": "whatsapp",\n "type": "image",\n "content": {\n "text": "John Doe",\n "url": "https://example.com/valid_image.jpeg"\n },\n "template_uuid": "d980fb66fd5043d3ace1aa06ba044342",\n "optin_contact": true\n }',
{
'to': '+31612345678',
'from': 'whatsapp',
'type': 'image',
'content': {
'text': 'John Doe',
'url': 'https://example.com/valid_image.jpeg'
},
'template_uuid': 'd980fb66fd5043d3ace1aa06ba044342',
'optin_contact': true
},
{
headers: {
'Authorization': 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type': 'application/json'
}
}
);
require 'net/http'
require 'json'
uri = URI('https://api.callbell.eu/v1/messages/send')
req = Net::HTTP::Post.new(uri)
req.content_type = 'application/json'
req['Authorization'] = 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM'
# The object won't be serialized exactly like this
# req.body = "{\n \"to\": \"+31612345678\",\n \"from\": \"whatsapp\",\n \"type\": \"image\",\n \"content\": {\n \"text\": \"John Doe\",\n \"url\": \"https://example.com/valid_image.jpeg\"\n },\n \"template_uuid\": \"d980fb66fd5043d3ace1aa06ba044342\",\n \"optin_contact\": true\n }"
req.body = {
'to' => '+31612345678',
'from' => 'whatsapp',
'type' => 'image',
'content' => {
'text' => 'John Doe',
'url' => 'https://example.com/valid_image.jpeg'
},
'template_uuid' => 'd980fb66fd5043d3ace1aa06ba044342',
'optin_contact' => true
}.to_json
req_options = {
use_ssl: uri.scheme == 'https'
}
res = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(req)
end
package main
import (
"fmt"
"io"
"log"
"net/http"
"strings"
)
func main() {
client := &http.Client{}
var data = strings.NewReader(`{
"to": "+31612345678",
"from": "whatsapp",
"type": "image",
"content": {
"text": "John Doe",
"url": "https://example.com/valid_image.jpeg"
},
"template_uuid": "d980fb66fd5043d3ace1aa06ba044342",
"optin_contact": true
}`)
req, err := http.NewRequest("POST", "https://api.callbell.eu/v1/messages/send", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer test_gshuPaZoeEG6ovbc8M79w0QyM")
req.Header.Set("Content-Type", "application/json")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
bodyText, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)
}
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.callbell.eu/v1/messages/send');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\n \"to\": \"+31612345678\",\n \"from\": \"whatsapp\",\n \"type\": \"image\",\n \"content\": {\n \"text\": \"John Doe\",\n \"url\": \"https://example.com/valid_image.jpeg\"\n },\n \"template_uuid\": \"d980fb66fd5043d3ace1aa06ba044342\",\n \"optin_contact\": true\n }");
$response = curl_exec($ch);
curl_close($ch);
import requests
headers = {
'Authorization': 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type': 'application/json',
}
json_data = {
'to': '+31612345678',
'from': 'whatsapp',
'type': 'image',
'content': {
'text': 'John Doe',
'url': 'https://example.com/valid_image.jpeg',
},
'template_uuid': 'd980fb66fd5043d3ace1aa06ba044342',
'optin_contact': True,
}
response = requests.post('https://api.callbell.eu/v1/messages/send', headers=headers, json=json_data)
# Note: json_data will not be serialized by requests
# exactly as it was in the original request.
#data = '{\n "to": "+31612345678",\n "from": "whatsapp",\n "type": "image",\n "content": {\n "text": "John Doe",\n "url": "https://example.com/valid_image.jpeg"\n },\n "template_uuid": "d980fb66fd5043d3ace1aa06ba044342",\n "optin_contact": true\n }'
#response = requests.post('https://api.callbell.eu/v1/messages/send', headers=headers, data=data)
Send Document Attachment
- cURL
- Node
- Ruby
- Go
- PHP
- Python
curl -X POST "https://api.callbell.eu/v1/messages/send" \
-H "Authorization: Bearer test_gshuPaZoeEG6ovbc8M79w0QyM" \
-H "Content-Type: application/json" \
-d '{
"to": "+31612345678",
"from": "whatsapp",
"type": "document",
"content": {
"text": "John Doe",
"url": "https://example.com/valid_document.pdf"
},
"template_uuid": "d980fb66fd5043d3ace1aa06ba044342",
"optin_contact": true
}'
const axios = require('axios');
const response = await axios.post(
'https://api.callbell.eu/v1/messages/send',
// '{\n "to": "+31612345678",\n "from": "whatsapp",\n "type": "document",\n "content": {\n "text": "John Doe",\n "url": "https://example.com/valid_document.pdf"\n },\n "template_uuid": "d980fb66fd5043d3ace1aa06ba044342",\n "optin_contact": true\n }',
{
'to': '+31612345678',
'from': 'whatsapp',
'type': 'document',
'content': {
'text': 'John Doe',
'url': 'https://example.com/valid_document.pdf'
},
'template_uuid': 'd980fb66fd5043d3ace1aa06ba044342',
'optin_contact': true
},
{
headers: {
'Authorization': 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type': 'application/json'
}
}
);
require 'net/http'
require 'json'
uri = URI('https://api.callbell.eu/v1/messages/send')
req = Net::HTTP::Post.new(uri)
req.content_type = 'application/json'
req['Authorization'] = 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM'
# The object won't be serialized exactly like this
# req.body = "{\n \"to\": \"+31612345678\",\n \"from\": \"whatsapp\",\n \"type\": \"document\",\n \"content\": {\n \"text\": \"John Doe\",\n \"url\": \"https://example.com/valid_document.pdf\"\n },\n \"template_uuid\": \"d980fb66fd5043d3ace1aa06ba044342\",\n \"optin_contact\": true\n }"
req.body = {
'to' => '+31612345678',
'from' => 'whatsapp',
'type' => 'document',
'content' => {
'text' => 'John Doe',
'url' => 'https://example.com/valid_document.pdf'
},
'template_uuid' => 'd980fb66fd5043d3ace1aa06ba044342',
'optin_contact' => true
}.to_json
req_options = {
use_ssl: uri.scheme == 'https'
}
res = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(req)
end
package main
import (
"fmt"
"io"
"log"
"net/http"
"strings"
)
func main() {
client := &http.Client{}
var data = strings.NewReader(`{
"to": "+31612345678",
"from": "whatsapp",
"type": "document",
"content": {
"text": "John Doe",
"url": "https://example.com/valid_document.pdf"
},
"template_uuid": "d980fb66fd5043d3ace1aa06ba044342",
"optin_contact": true
}`)
req, err := http.NewRequest("POST", "https://api.callbell.eu/v1/messages/send", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer test_gshuPaZoeEG6ovbc8M79w0QyM")
req.Header.Set("Content-Type", "application/json")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
bodyText, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)
}
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.callbell.eu/v1/messages/send');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\n \"to\": \"+31612345678\",\n \"from\": \"whatsapp\",\n \"type\": \"document\",\n \"content\": {\n \"text\": \"John Doe\",\n \"url\": \"https://example.com/valid_document.pdf\"\n },\n \"template_uuid\": \"d980fb66fd5043d3ace1aa06ba044342\",\n \"optin_contact\": true\n }");
$response = curl_exec($ch);
curl_close($ch);
import requests
headers = {
'Authorization': 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type': 'application/json',
}
json_data = {
'to': '+31612345678',
'from': 'whatsapp',
'type': 'document',
'content': {
'text': 'John Doe',
'url': 'https://example.com/valid_document.pdf',
},
'template_uuid': 'd980fb66fd5043d3ace1aa06ba044342',
'optin_contact': True,
}
response = requests.post('https://api.callbell.eu/v1/messages/send', headers=headers, json=json_data)
# Note: json_data will not be serialized by requests
# exactly as it was in the original request.
#data = '{\n "to": "+31612345678",\n "from": "whatsapp",\n "type": "document",\n "content": {\n "text": "John Doe",\n "url": "https://example.com/valid_document.pdf"\n },\n "template_uuid": "d980fb66fd5043d3ace1aa06ba044342",\n "optin_contact": true\n }'
#response = requests.post('https://api.callbell.eu/v1/messages/send', headers=headers, data=data)
Send Video Attachment
- cURL
- Node
- Ruby
- Go
- PHP
- Python
curl -X POST "https://api.callbell.eu/v1/messages/send" \
-H "Authorization: Bearer test_gshuPaZoeEG6ovbc8M79w0QyM" \
-H "Content-Type: application/json" \
-d '{
"to": "+31612345678",
"from": "whatsapp",
"type": "video",
"content": {
"text": "John Doe",
"url": "https://example.com/valid_video.mp4"
},
"template_uuid": "d980fb66fd5043d3ace1aa06ba044342",
"optin_contact": true
}'
const axios = require('axios');
const response = await axios.post(
'https://api.callbell.eu/v1/messages/send',
// '{\n "to": "+31612345678",\n "from": "whatsapp",\n "type": "video",\n "content": {\n "text": "John Doe",\n "url": "https://example.com/valid_video.mp4"\n },\n "template_uuid": "d980fb66fd5043d3ace1aa06ba044342",\n "optin_contact": true\n }',
{
'to': '+31612345678',
'from': 'whatsapp',
'type': 'video',
'content': {
'text': 'John Doe',
'url': 'https://example.com/valid_video.mp4'
},
'template_uuid': 'd980fb66fd5043d3ace1aa06ba044342',
'optin_contact': true
},
{
headers: {
'Authorization': 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type': 'application/json'
}
}
);
require 'net/http'
require 'json'
uri = URI('https://api.callbell.eu/v1/messages/send')
req = Net::HTTP::Post.new(uri)
req.content_type = 'application/json'
req['Authorization'] = 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM'
# The object won't be serialized exactly like this
# req.body = "{\n \"to\": \"+31612345678\",\n \"from\": \"whatsapp\",\n \"type\": \"video\",\n \"content\": {\n \"text\": \"John Doe\",\n \"url\": \"https://example.com/valid_video.mp4\"\n },\n \"template_uuid\": \"d980fb66fd5043d3ace1aa06ba044342\",\n \"optin_contact\": true\n }"
req.body = {
'to' => '+31612345678',
'from' => 'whatsapp',
'type' => 'video',
'content' => {
'text' => 'John Doe',
'url' => 'https://example.com/valid_video.mp4'
},
'template_uuid' => 'd980fb66fd5043d3ace1aa06ba044342',
'optin_contact' => true
}.to_json
req_options = {
use_ssl: uri.scheme == 'https'
}
res = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(req)
end
package main
import (
"fmt"
"io"
"log"
"net/http"
"strings"
)
func main() {
client := &http.Client{}
var data = strings.NewReader(`{
"to": "+31612345678",
"from": "whatsapp",
"type": "video",
"content": {
"text": "John Doe",
"url": "https://example.com/valid_video.mp4"
},
"template_uuid": "d980fb66fd5043d3ace1aa06ba044342",
"optin_contact": true
}`)
req, err := http.NewRequest("POST", "https://api.callbell.eu/v1/messages/send", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer test_gshuPaZoeEG6ovbc8M79w0QyM")
req.Header.Set("Content-Type", "application/json")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
bodyText, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)
}
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.callbell.eu/v1/messages/send');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\n \"to\": \"+31612345678\",\n \"from\": \"whatsapp\",\n \"type\": \"video\",\n \"content\": {\n \"text\": \"John Doe\",\n \"url\": \"https://example.com/valid_video.mp4\"\n },\n \"template_uuid\": \"d980fb66fd5043d3ace1aa06ba044342\",\n \"optin_contact\": true\n }");
$response = curl_exec($ch);
curl_close($ch);
import requests
headers = {
'Authorization': 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type': 'application/json',
}
json_data = {
'to': '+31612345678',
'from': 'whatsapp',
'type': 'video',
'content': {
'text': 'John Doe',
'url': 'https://example.com/valid_video.mp4',
},
'template_uuid': 'd980fb66fd5043d3ace1aa06ba044342',
'optin_contact': True,
}
response = requests.post('https://api.callbell.eu/v1/messages/send', headers=headers, json=json_data)
# Note: json_data will not be serialized by requests
# exactly as it was in the original request.
#data = '{\n "to": "+31612345678",\n "from": "whatsapp",\n "type": "video",\n "content": {\n "text": "John Doe",\n "url": "https://example.com/valid_video.mp4"\n },\n "template_uuid": "d980fb66fd5043d3ace1aa06ba044342",\n "optin_contact": true\n }'
#response = requests.post('https://api.callbell.eu/v1/messages/send', headers=headers, data=data)
Use the Templates API to the get the template_uuid
s your templates.