Send Group Message
curl --request POST \
--url https://api.a1base.com/v1/messages/group/{accountId}/send \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--header 'X-API-Secret: <api-key>' \
--data '
{
"content": "<string>",
"from": "<string>",
"thread_id": "<string>",
"attachment_uri": "<string>"
}
'import requests
url = "https://api.a1base.com/v1/messages/group/{accountId}/send"
payload = {
"content": "<string>",
"from": "<string>",
"thread_id": "<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>',
thread_id: '<string>',
attachment_uri: '<string>'
})
};
fetch('https://api.a1base.com/v1/messages/group/{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/group/{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>',
'thread_id' => '<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/group/{accountId}/send"
payload := strings.NewReader("{\n \"content\": \"<string>\",\n \"from\": \"<string>\",\n \"thread_id\": \"<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/group/{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 \"thread_id\": \"<string>\",\n \"attachment_uri\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.a1base.com/v1/messages/group/{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 \"thread_id\": \"<string>\",\n \"attachment_uri\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"chat_group_id": "<string>",
"from": "<string>",
"body": "<string>",
"status": "queued",
"date_created": "2023-11-07T05:31:56Z"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Group Message Endpoints
Create Group Messages
Send a message to a group chat
POST
/
messages
/
group
/
{accountId}
/
send
Send Group Message
curl --request POST \
--url https://api.a1base.com/v1/messages/group/{accountId}/send \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--header 'X-API-Secret: <api-key>' \
--data '
{
"content": "<string>",
"from": "<string>",
"thread_id": "<string>",
"attachment_uri": "<string>"
}
'import requests
url = "https://api.a1base.com/v1/messages/group/{accountId}/send"
payload = {
"content": "<string>",
"from": "<string>",
"thread_id": "<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>',
thread_id: '<string>',
attachment_uri: '<string>'
})
};
fetch('https://api.a1base.com/v1/messages/group/{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/group/{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>',
'thread_id' => '<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/group/{accountId}/send"
payload := strings.NewReader("{\n \"content\": \"<string>\",\n \"from\": \"<string>\",\n \"thread_id\": \"<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/group/{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 \"thread_id\": \"<string>\",\n \"attachment_uri\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.a1base.com/v1/messages/group/{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 \"thread_id\": \"<string>\",\n \"attachment_uri\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"chat_group_id": "<string>",
"from": "<string>",
"body": "<string>",
"status": "queued",
"date_created": "2023-11-07T05:31:56Z"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Sending Group Messages:
- The agent’s phone number must first be added to the group chat before messages can be sent.
- You’ll need the thread_id of the group chat to send messages. This is provided when you create a group or in webhook events.
Example Request
Text Message to Group
POST /group/{accountId}/send
Headers:
x-api-key: your_api_key
x-api-secret: your_api_secret
Content-Type: application/json
Body:
{
"from": "+14155552671",
"thread_id": "group-thread-id-123",
"service": "whatsapp",
"message": "Hello everyone in the group!"
}
Media Message to Group
To send a document to a group:POST /group/{accountId}/send
Headers:
x-api-key: your_api_key
x-api-secret: your_api_secret
Content-Type: application/json
Body:
{
"from": "+14155552671",
"thread_id": "group-thread-id-123",
"service": "whatsapp",
"message_type": "media",
"media_url": "https://example.com/documents/report.pdf",
"media_type": "document",
"caption": "Here's the quarterly report"
}
Using the Universal Endpoint for Groups
You can also use the newer universal endpoint for group messages:POST /send/{accountId}
Headers:
x-api-key: your_api_key
x-api-secret: your_api_secret
Content-Type: application/json
Body:
{
"from": "+14155552671",
"thread_id": "group-thread-id-123",
"service": "whatsapp",
"type": "group",
"content": {
"type": "media",
"media_url": "https://example.com/videos/demo.mp4",
"media_type": "video",
"caption": "Product demo video for the team"
}
}
Important Notes for Group Media Messages
- For group messages, you need a valid
thread_idinstead of atonumber. - The
captionfield is optional. You can send media without a caption if desired. - The same media type and size restrictions apply as with individual messages:
- Images: Generally up to 5MB
- Videos: Generally up to 16MB
- Audio: Generally up to 16MB
- Documents: Generally up to 100MB
- The agent must be a member of the group before sending messages.
Path Parameters
Body
application/json

