Follow this tutorial to send your first message using the Qwetty API.
Prerequisites
- A connected channel (WhatsApp, Instagram, or Web Chat)
- An API key — Create one here
Step 1: List your chats
First, find an existing conversation:
curl -X GET "https://api.qwetty.com/api/v1/chats?page=1&limit=5" \
-H "Authorization: Bearer YOUR_API_KEY"
Response:
{
"success": true,
"data": [
{
"id": "chat_abc123",
"name": "John Doe",
"type": "PRIVATE",
"channelId": "ch_xyz"
}
],
"meta": {
"page": 1,
"limit": 5,
"total": 42
}
}
Step 2: Send a text message
Using a chat ID from the previous step:
curl -X POST "https://api.qwetty.com/api/v1/chats/chat_abc123/messages" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"content": "Hello from the API!"}'
Response:
{
"success": true,
"data": {
"id": "msg_def456",
"chatId": "chat_abc123",
"text": "Hello from the API!",
"type": "TEXT",
"sentAt": "2024-01-15T10:30:00Z"
}
}
Step 3: Send a template message
For WhatsApp (outside the 24-hour window), use a template:
curl -X POST "https://api.qwetty.com/api/v1/send-template" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"templateId": "tmpl_ghi789",
"chatId": "chat_abc123"
}'
Step 4: View message history
Fetch messages from a chat:
curl -X GET "https://api.qwetty.com/api/v1/chats/chat_abc123/messages?page=1&limit=20" \
-H "Authorization: Bearer YOUR_API_KEY"
What's next?
Last modified on