Skip to main content

Send Message

This API is used to send messages from the client system to the end user through various supported channels ( WhatsApp, Telegram, LINE, and Facebook Messenger )

Endpoint

URL : {base url}/{channel}/send/{clientID}
Method : POST
Headers : Auth-username: {username} and Auth-password: {password}

Request

This section describes the request parameters and provides examples of JSON requests used to send a message.
Description Parameter Request
FIELDTYPE ALLOWEDDESCRIPTIONREQUIRED
idStringUnique code from Message IDMandatory
reply_idStringUnique code from ID of the message being repliedOptional
timesIntegerFormat = Unix Timestamp from sending messageMandatory
timestampTimestampFormat = Date Time from sending messagesMandatory
reply_tokenStringToken for Telegram replies onlyOptional
recipientStringRecipient's phone numberMandatory
typeStringMessage type: text, image, video, audio, button, list, locationMandatory
bodyJSON ObjectFor the message contained in the bodyOptional
textStringText message content ( for type text)Mandatory
mediaJSON ObjectFor message type Media ( image, video, audio, voice, document)Optional
urlStringURL of the media file ( for type image/video/audio/voice/document)Mandatory
nameStringDisplay name of the media file ( for type image/video/audio/voice/document)Optional
locationJSON ObjectFor message type LocationOptional
latitudeFloatLatitude coordinate (for type location)Mandatory
longitudeFloatLongitude coordinate (for type location)Mandatory
buttonJSON ObjectFor the message contained in the button
keyStringButton ID received from the client and returned back when a postback is triggered by the client (for type button)Mandatory
titleStringButton label (for type button)Mandatory
listJSON ObjectFor the message contained in the listOptional
titleStringTitle of the list (for type list)Mandatory
sectionsArrayselectable sectionMandatory
titleStringTitle of the list sectionMandatory
descriptionStringDescription of the list sectionMandatory
actionsArrayselectable actionsMandatory
keyStringlist ID received from the client and returned if there is a post back from the client.Mandatory
titleStringName of the selected list actionMandatory
descriptionStringDescription of the selected list actionMandatory
headerJSON Objectcustom message in header for type button/list)Optional
typeStringMessage type: text, image, video, document,Mandatory
textStringText header content ( for type text)Mandatory
media_urlStringURL of the media file for header ( for type image/video/document)Mandatory
footerJSON Objectcustom message in footer for type button/list)Optional
titleStringTitle of the footerMandatory
textStringText footer contentMandatory
Sample JSON Request
{
"id": "3c0b1912-xxxx-xxxx-xxxx-xxxxxxxxxx",
"reply_id": "",
"times": 0,
"timestampt": "2023-11-10T12:38:08.153726382+07:00",
"reply_token": "",
"recipient": "628xxxxxxxx",
//Type: text/image/video/audio/button/list/location
"type": "text",
"body": {
"text": "xxx xxxx xxxxx.",
// Type image/video/audio/voice/document
"media": {
"url": "",
"name": ""
},
// Type location
"location": {
"latitude": 0,
"longitude": 0
},
// Type button
"button": [{
"key": "btn1",
"title": "Button 1"
},
{
"key": "btn2",
"title": "Button 2"
},
{
"key": "btn3",
"title": "Button 3"
}
],
// Type list
"list": {
"title": "",
"sections": [{
"title": "Section 1",
"description": "Description section 1",
"actions": [{
"key": "sec1act1",
"title": "Action 1",
"description": "Description action 1"
},
{
"key": "sec1act2",
"title": "Action 2",
"description": "Description action 2"
},
{
"key": "sec1act3",
"title": "Action 3",
"description": "Description action 3"
}
]
}]
}
},
// special type button/list
"header": {
//Type: text/image/video/document
"type": "",
"text": "",
"media_url": ""
},
// special type button/list
"footer": {
"title": "",
"text": ""
}
}

Response

This section describes the response parameters and provides JSON response examples returned by the Konnek platform after a message is sent.
Description Parameter Response
FIELDTYPE ALLOWEDDESCRIPTION
metaJSON ObjectDetails information from meta
statusBooleantrue = success,false = failed
codeStringHTTP response status code
messageStringDescription of the result from the statusCode
errorsStringError message (if any)
dataJSON ObjectDetailed Information from the Message Sent
message_idStringID of the message sent
statusIntegerMessage status:
-3 Failed,
-2 Undelivered,
-1 Unsent,
0 Pending,
1 Sent,
2 Delivered,
3 Read
tidStringTransaction ID for message tracking
Sample JSON Response
{
"meta": {
"status": true,
"code": 200,
"message": "OK",
"errors": null
},
"data": {
"message_id": "3c0b1912-xxx-xxxx-xxxx-xxxxxxxx",
"status": 0,
"tid": "b3d31d85-xxxx-xxxx-xxxx-xxxxxxxxx"
}
}