Appearance
Send Message
POST/public/chat/{chatId}/messageSend a new message in a chat conversation. The message body can include text or other supported content types.
Endpoint Details
- Authentication: Basic Auth (
Authorization: Basic Base64(AccessKey:SecretKey)) - Access Tier: Gold+
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
chatId | string | Yes | The unique identifier of the chat conversation. |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Content type to post. Options: text, image, video, audio, document, button. |
text | string | No | The message text content to send. |
image | object | No | Image attachment object. |
video | object | No | Video attachment object. |
audio | object | No | Audio attachment object. |
document | object | No | Document file attachment object. |
button | object | No | Interactive button attachment with URL. |
Example Request
bash
curl -X POST "https://api.repliz.com/public/chat/680affa5ce12f2f72916f67e/message" \
-H "Authorization: Basic $(echo -n 'YOUR_ACCESS_KEY:YOUR_SECRET_KEY' | base64)" \
-H "Content-Type: application/json" \
-d '{"type":"text","text":"Hello there, this is from Repliz"}'javascript
import axios from 'axios';
const chatId = '680affa5ce12f2f72916f67e';
const response = await axios.post(`https://api.repliz.com/public/chat/${chatId}/message`, {
"type": "text",
"text": "Hello there, this is from Repliz"
}, {
auth: {
username: 'YOUR_ACCESS_KEY',
password: 'YOUR_SECRET_KEY'
}
});
console.log(response.data);javascript
const credentials = btoa('YOUR_ACCESS_KEY:YOUR_SECRET_KEY');
const chatId = '680affa5ce12f2f72916f67e';
const response = await fetch(`https://api.repliz.com/public/chat/${chatId}/message`, {
method: 'POST',
headers: {
'Authorization': `Basic ${credentials}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
"type": "text",
"text": "Hello there, this is from Repliz"
})
});
const data = await response.json();
console.log(data);Response
json
{
"messageId": "m_ab2lk1uLlqxSwS_E6ufOaaDllBn-ZQje_xFEJPRwKTzIXkUK_ykxcfo9GDvv26nfY0g-1zNA7K_hcSKuUZ18XA"
}json
// Chat
{
"code": 404,
"message": "chat not found"
}
// Account
{
"code": 404,
"message": "account not found"
}json
{
"code": 401,
"message": "unauthorized"
}