Please see ChatApps Send API for the full API reference.
If you want to send a text message, your request will look like this:
{
"user": {
"msisdn": "+65000000"
},
"clientMessageId": "1234_id",
"type": "text",
"content": {
"text": "Hello World!",
"sms": {
"encoding": "AUTO",
"source": "SENDERID"
}
}
}
If you want to send an image with a text (optional) and a fallback text (optional), your request will look like this:
{
"user": {
"msisdn": "+65000000"
},
"clientMessageId": "1234_id",
"type": "image",
"content": {
"text": "Welcome to Singapore!",
"url": "https://example.com/media/image.jpg",
"fallbackText": "We tried to send an image - but Welcome to Singapore",
"sms": {
"encoding": "AUTO",
"source": "SENDERID"
}
}
}
If you want to send a WeChat message, you need to specify the WeChatId of the user. As there are no delivery receipts on WeChat, there will be no fallbacks, hence the msisdn is not required. Your request will look like this:
{
"user": {
"weChatUserId": "wsknf_12324k4n2n22"
},
"clientMessageId": "1234_id",
"type": "image",
"content": {
"text": "Welcome to Singapore!",
"url": "https://example.com/media/image.jpg",
"fallbackText": "We tried to send an image - but Welcome to Singapore",
"sms": {
"encoding": "AUTO",
"source": "SENDERID"
}
}
}
If you want to send a template message only on WhatsApp, your request will look like this (this template has two parameters):
{
"user": {
"msisdn": "+65000000"
},
"clientMessageId": "1234_id",
"type": "template",
"content": {
"template": {
"language": "en",
"name": "template_name_1",
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "Mr. John"
},
{
"type": "text",
"text": "http://example.com"
}
]
}
]
}
}
}
If you want to send a rich template message only on WhatsApp, your request will look like this (this template has an image header and two parameters):
{
"user": {
"msisdn": "+65000000"
},
"clientMessageId": "1234_id",
"type": "template",
"content": {
"template": {
"language": "en",
"name": "template_name_1",
"components": [
{
"type": "header",
"parameters": [
{
"type": "image",
"url": "https://example.com/media/image.jpg"
}
]
},
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "Mr. John"
},
{
"type": "text",
"text": "http://example.com"
}
]
}
]
}
}
}
If you want to send a rich template message only on WhatsApp, your request will look like this (this template has a location header and two parameters):
{
"user": {
"msisdn": "+65000000"
},
"clientMessageId": "1234_id",
"type": "template",
"content": {
"template": {
"language": "en",
"name": "template_name_1",
"components": [
{
"type": "header",
"parameters": [
{
"type": "location",
"location":{
"latitude": "1.3521",
"longitude": "103.8198"
}
}
]
},
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "Mr. John"
},
{
"type": "text",
"text": "http://example.com"
}
]
}
]
}
}
}
Updated about a month ago