π‘ 2BeBot Messaging API
Send template and non-template messages through your registered 2BeBot channel.
π Endpoint
POST /api/v1/2bebot/:id/messages:id= 2BeBot channel ID (required)
π Authentication
All requests must include the API key via the Authorization header:
You can get your API key from the /companies page.
Authorization: Bearer YOUR_API_KEYπ₯ Request Parameters
πΈ Path Parameter
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | β Yes | 2BeBot channel ID you want to use |
π¦ Request Body (General Structure)
{
"phone_number": "+254712345678",
"type": "text" | "image" | "video" | "audio" | "document" | "template",
"message": "Hello world",
"link": "https://example.com/file.mp4",
"caption": "Your caption here",
"template_id": "123456789",
"components": [ ... ]
}π― Message Types and Payloads
1. π¨ Text Message
{
"phone_number": "+254712345678",
"type": "text",
"message": "Hello! This is a test message"
}2. πΌοΈ Image Message
{
"phone_number": "+254712345678",
"type": "image",
"link": "https://example.com/image.jpg",
"caption": "Check out this photo"
}3. π₯ Video Message
{
"phone_number": "+254712345678",
"type": "video",
"link": "https://example.com/video.mp4",
"caption": "Watch this!"
}4. π Audio Message
{
"phone_number": "+254712345678",
"type": "audio",
"link": "https://example.com/audio.mp3"
}5. π Document Message
{
"phone_number": "+254712345678",
"type": "document",
"link": "https://example.com/file.pdf",
"caption": "Please review the file"
}6. π§© Template Message
{
"phone_number": "+254712345678",
"type": "template",
"template_id": "promo_template",
"components": [
{
"type": "header",
"parameters": [
{
"type": "image",
"link": "https://example.com/header.jpg"
}
]
},
{
"type": "body",
"parameters": [
{ "type": "text", "text": "Dennis" },
{ "type": "text", "text": "20% OFF" }
]
},
{
"type": "button",
"sub_type": "url",
"index": "0",
"parameters": [{ "type": "text", "text": "promo123" }]
}
]
}7. π§© Interactive Buttons Message
{
"phone_number": "+254712345678",
"type": "interactive",
"interactive": {
"type": "button",
"body": {
"text": "Escolha qual carnΓͺ vocΓͺ deseja resgatar no meu abaixo!"
},
"action": {
"buttons": [
{
"type": "reply",
"reply": {
"id": "ID1",
"title": "BotΓ£o 1"
}
},
{
"type": "reply",
"reply": {
"id": "ID2",
"title": "BotΓ£o 2"
}
}
]
}
}
}8. π§© Interactive List Message
{
"phone_number": "+254712345678",
"type": "interactive",
"interactive": {
"type": "list",
"body": {
"text": "ExemplodeMensagemLista"
},
"action": {
"button": "menutext",
"sections": [
{
"title": "SectionTitle",
"rows": [
{
"id": "1",
"title": "Bruno",
"description": "19984440001"
},
{
"id": "2",
"title": "Bruno2",
"description": "19984440002"
},
{
"id": "3",
"title": "Bruno2",
"description": "19984440003"
}
]
}
]
}
}
}9. π§© Interactive Product List Message
{
"phone_number": "+254712345678",
"type": "interactive",
"interactive": {
"type": "product_list",
"header": {
"type": "text",
"text": "Texto Header"
},
"body": {
"text": "Texto Body"
},
"footer": {
"text": "Texto Footer"
},
"action": {
"catalog_id": "829935987679103",
"sections": [
{
"title": "Pizzas",
"product_items": [
{
"product_retailer_id": "pizza-queijo"
}
]
},
{
"title": "Refrigerantes",
"product_items": [
{
"product_retailer_id": "coca-2l"
},
{
"product_retailer_id": "coca-fardo"
}
]
}
]
}
}
}10. π§© Interactive One product Message
{
"phone_number": "+254712345678",
"type": "interactive",
"interactive": {
"type": "product",
"body": {
"text": "Texto Body"
},
"footer": {
"text": "Texto Footer"
},
"action": {
"catalog_id": "829935987679103",
"product_retailer_id": "P01002"
}
}
}π§ͺ Example cURL
curl -X POST https://smart.botatende.com/api/v1/whatsapp/123/messages \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "+254712345678",
"type": "text",
"message": "Hello from the API!"
}'β Response
{
"index": 0,
"message": "To search your message later, use this ID",
"message_id": "68acae8b6837dfb6902a50b1"
}β Error Responses
{
"index": 0,
"error": {
"code": "invalid_type",
"message": "Message type is not supported"
}
}
| Status | Code | Message |
| ------ | ------------------------------ | ----------------------------------------- |
| 400 | `invalid_type` | Message type is not supported |
| 400 | `missing_phone_number` | `phone_number` is required |
| 400 | `missing_message` | For `text` type |
| 400 | `missing_link` | For media types |
| 400 | `missing_template_id` | For template type |
| 400 | `missing_components` | For template type |
| 401 | `invalid_api_key` | Invalid or missing API key |
| 403 | `credential_resource_mismatch` | 2BeBot channel does not belong to API key |
| 404 | β | 2BeBot channel ID not found |
| 500 | β | Internal server error |
---
## π Notes
- Media links must be publicly accessible URLs.
- Template id must match exactly as returned by the get templates API.
- Rate limits and template usage quotas depend on your 2BeBot settings.
---