Messages API
This page is used to implement SendTalk messages APIs, please refer to these following APIs

Send Message API

post
https://sendtalk-api.taptalk.io/api/v1/message
/send_whatsapp
Send Message
Message Types The difference between OTP type and TEXT type is based on the queue of our system. The message withOTPtype will be prioritized first than the other type in sending the message.
Important Do not forget to add API-Key in Headers and make sure the Body Parameters type is JSON

Request

Field
Type
Description
phone
string
The phone number to send the message to.
messageType
string
The message type.
Allowed values: "otp", "text", "image".
body
string
The message body (text message or file URL).
fileName (optional)
string
The name of the file (required for message type other than "otp" and "text").
caption (optional)
string
The caption, if any (for message type "image").
Below is the example of the request:
TEXT
1
{
2
"phone": "6281212345678",
3
"messageType": "text",
4
"body": "Hi this is a message"
5
}
Copied!
IMAGE
1
{
2
"phone": "6281212345678",
3
"messageType": "image",
4
"body": "http://www.example.com/chat/file/image/008dce72-06c0?token=802714",
5
"filename": "my-photo.jpg",
6
"caption": "This is the photo."
7
Copied!

Response Success 200

Field
Type
Description
success
boolean
If message is sent successfully.
message
string
The success or error message.
reason
string
Failure reason ("invalid_recipient", "insufficient_balance").
id
string
The message ID, if successful.
Success Response
1
HTTP/1.1 200 OK
2
{
3
"status": 200,
4
"error": {
5
"code": "",
6
"message": "",
7
"field": ""
8
},
9
"data": {
10
"success": true,
11
"message": "The message has been added to queue",
12
"reason": "",
13
"id": "f26ccf7a-d867-b3a4-d333-117ec668718d"
14
}
15
}
Copied!

Response Error 4xx

Name
Description
ParamValidationFailed
The parameter validation failed.
HeaderValidationFailed
The request header validation failed.
ParamValidationFailed
1
HTTP/1.1 200 OK
2
{
3
"status": 400,
4
"error": {
5
"code": "40002",
6
"message": "Phone is required",
7
"field": "phone"
8
},
9
"data": {}
10
}
Copied!
HeaderValidationFailed
1
HTTP/1.1 200 OK
2
{
3
"status": 400,
4
"error": {
5
"code": "40001",
6
"message": "Request headers are required (API-Key)",
7
"field": ""
8
},
9
"data": {}
10
}
Copied!

Get Send Status API

post
https://sendtalk-api.taptalk.io/api/v1/message
/get_status
Get Status Message
Important Do not forget to add API-Key in Headers and make sure the Body Parameters type is JSON

Request

Field
Type
Description
id
string
The ID of the message.
Below is the example of the request:
1
{
2
"id": "3f581b4e-8e7c-4ebf-a533-39115737b81c"
3
}
Copied!

Response Success 200

Field
Type
Description
status
string
The message status
isPending
boolean
If the message is pending
isSent
boolean
If the message has been sent to the channel
sentTime
long
The time the message was sent, in Unix milliseconds
currency
string
The currency
price
long
The charged price
createdTime
long
The time the message was created, in Unix milliseconds
Success Response
1
HTTP/1.1 200 OK
2
{
3
"status": 200,
4
"error": {
5
"code": "",
6
"message": "",
7
"field": ""
8
},
9
"data": {
10
"status": "sent",
11
"isPending": false,
12
"isSent": true,
13
"sentTime": 1635774548482,
14
"currency": "IDR",
15
"price": 100,
16
"createdTime": 1635774547004
17
}
18
}
Copied!

Response Error 4xx

Name
Description
ParamValidationFailed
The parameter validation failed.
ItemNotFound
The message ID is not found.
HeaderValidationFailed
The request header validation failed.
ParamValidationFailed
1
HTTP/1.1 200 OK
2
{
3
"status": 400,
4
"error": {
5
"code": "40002",
6
"message": "Message ID is required",
7
"field": "id"
8
},
9
"data": {}
10
}
Copied!
ItemNotFound
1
HTTP/1.1 200 OK
2
{
3
"status": 404,
4
"error": {
5
"code": "40401",
6
"message": "Message is not found",
7
"field": ""
8
},
9
"data": {}
10
}
Copied!
HeaderValidationFailed
1
HTTP/1.1 200 OK
2
{
3
"status": 400,
4
"error": {
5
"code": "40001",
6
"message": "Request headers are required (API-Key)",
7
"field": ""
8
},
9
"data": {}
10
}
Copied!