Send Message
curl --request POST \
--url https://api.a1base.com/v1/messages/individual/{accountId}/send \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--header 'X-API-Secret: <api-key>' \
--data '
{
"content": "<string>",
"from": "<string>",
"to": "<string>",
"attachment_uri": "<string>"
}
'import requests
url = "https://api.a1base.com/v1/messages/individual/{accountId}/send"
payload = {
"content": "<string>",
"from": "<string>",
"to": "<string>",
"attachment_uri": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"X-API-Secret": "<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>',
'X-API-Secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
content: '<string>',
from: '<string>',
to: '<string>',
attachment_uri: '<string>'
})
};
fetch('https://api.a1base.com/v1/messages/individual/{accountId}/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.a1base.com/v1/messages/individual/{accountId}/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([
'content' => '<string>',
'from' => '<string>',
'to' => '<string>',
'attachment_uri' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>",
"X-API-Secret: <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://api.a1base.com/v1/messages/individual/{accountId}/send"
payload := strings.NewReader("{\n \"content\": \"<string>\",\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"attachment_uri\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("X-API-Secret", "<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://api.a1base.com/v1/messages/individual/{accountId}/send")
.header("X-API-Key", "<api-key>")
.header("X-API-Secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"content\": \"<string>\",\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"attachment_uri\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.a1base.com/v1/messages/individual/{accountId}/send")
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["X-API-Secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"content\": \"<string>\",\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"attachment_uri\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"to": "<string>",
"from": "<string>",
"body": "<string>",
"status": "queued",
"date_created": "2023-11-07T05:31:56Z"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Individual Message Endpoints
Create Messages
Send a message to an individual recipient
POST
/
messages
/
individual
/
{accountId}
/
send
Send Message
curl --request POST \
--url https://api.a1base.com/v1/messages/individual/{accountId}/send \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--header 'X-API-Secret: <api-key>' \
--data '
{
"content": "<string>",
"from": "<string>",
"to": "<string>",
"attachment_uri": "<string>"
}
'import requests
url = "https://api.a1base.com/v1/messages/individual/{accountId}/send"
payload = {
"content": "<string>",
"from": "<string>",
"to": "<string>",
"attachment_uri": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"X-API-Secret": "<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>',
'X-API-Secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
content: '<string>',
from: '<string>',
to: '<string>',
attachment_uri: '<string>'
})
};
fetch('https://api.a1base.com/v1/messages/individual/{accountId}/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.a1base.com/v1/messages/individual/{accountId}/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([
'content' => '<string>',
'from' => '<string>',
'to' => '<string>',
'attachment_uri' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>",
"X-API-Secret: <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://api.a1base.com/v1/messages/individual/{accountId}/send"
payload := strings.NewReader("{\n \"content\": \"<string>\",\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"attachment_uri\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("X-API-Secret", "<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://api.a1base.com/v1/messages/individual/{accountId}/send")
.header("X-API-Key", "<api-key>")
.header("X-API-Secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"content\": \"<string>\",\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"attachment_uri\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.a1base.com/v1/messages/individual/{accountId}/send")
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["X-API-Secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"content\": \"<string>\",\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"attachment_uri\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"to": "<string>",
"from": "<string>",
"body": "<string>",
"status": "queued",
"date_created": "2023-11-07T05:31:56Z"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Sending Messages:
- Group Chats: The agent’s phone number must first be added to the group chat before messages can be sent.
- Individual Chats: A user must initiate the conversation with the agent’s phone number before the agent can send messages.
Sending Text Messages
POST /individual/{accountId}/send
Headers:
x-api-key: your_api_key
x-api-secret: your_api_secret
Content-Type: application/json
Body:
{
"from": "+14155552671",
"to": "+14155551234",
"service": "whatsapp",
"message": "Hello, this is a test message!"
}
Sending Media Messages
Individual Media Message
To send an image to an individual:POST /individual/{accountId}/send
Headers:
x-api-key: your_api_key
x-api-secret: your_api_secret
Content-Type: application/json
Body:
{
"from": "+14155552671",
"to": "+14155551234",
"service": "whatsapp",
"message_type": "media",
"media_url": "https://example.com/images/sample.jpg",
"media_type": "image",
"caption": "Check out this image!"
}
Using the Universal Endpoint
You can also use the newer universal endpoint for both text and media messages:POST /send/{accountId}
Headers:
x-api-key: your_api_key
x-api-secret: your_api_secret
Content-Type: application/json
Body:
{
"from": "+14155552671",
"to": "+14155551234",
"service": "whatsapp",
"type": "individual",
"content": {
"type": "media",
"media_url": "https://example.com/videos/demo.mp4",
"media_type": "video",
"caption": "Product demo video"
}
}
Supported Media Types
The API supports these media types:- image: For images (JPG, PNG, etc.)
- video: For video files
- audio: For audio files
- document: For documents (PDF, DOC, etc.)
Important Notes
- The
media_urlmust be a publicly accessible URL where the media file can be downloaded. - The
captionfield is optional. You can send media without a caption if desired. - Make sure your media files are in formats supported by WhatsApp.
- There are size limits for different media types:
- Images: Generally up to 5MB
- Videos: Generally up to 16MB
- Audio: Generally up to 16MB
- Documents: Generally up to 100MB
- The
fromnumber must be a WhatsApp-enabled number that your account has permission to use. - The
tonumber for individual messages must be a valid WhatsApp number.
Path Parameters
Account ID
Body
application/json

