Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To send a new message call the following URL

POST https://<hostname>/imchanneimchannel/message

Text Message

There are two ways how incoming messages can be forwarded to the client's end-point. They can be delivered with or without contact name.

...

Code Block
languagejson
{
  "results": [
    {
      "from": "385919998888",
      "to": "1234",
      "integrationType": "WHATSAPP",
      "receivedAt": "2019-07-19T11:23:26.998+0000",
      "messageId": "ABEGOFl3VCQoAhBalbc6rTQT6mgS29EmGZ7a",
      "pairedMessageId": null,
      "message": {
        "type": "TEXT",
        "text": "Support hello"
      },
      "contact": {
        "name": "Frank"
      }    
    }
  ]
}	

Notes:

Parameter names

Type

Description

from

string

From Identifier

to

string

To identifier

integrationType

string

channel name

receivedAt

string

Timestamp indicating when the message has been received by the platform

messageId

string

unique identifier for message. In case of network problem it’s possibile to resend the same message with the same messageID.

pairedMessageID

string

reference to another message for “quote” feature

message.type

string

TEXT for text messages

message.text

string

content of the text message

contact.name

string

name linked with the from identifier if available

Image message

An image message is identified bu type “IMAGE” and the payload is transferred through a URL called by CTLive when the message is received. Url is requested using GET only once, because after that, it’s stored for any use.

...

If you would like to send WhatsApp messages containing text and image, please check the example provided below.

Parameter

Type

Description

text

string

Text of the message that will be sent.

imageUrl

string

URL of the image sent

Code Block
languagejson
{
    "scenarioKey": "CC9F01A5DC7BEE2C2B829D203482A654",
    "destinations": [
        {
            "to": {
                "phoneNumber": "41793026727"
            }
        }
    ],
    "whatsApp": {
        "text": "Get your message across!",
        "imageUrl": "<url>"
    },
}	

...

If you would like to send messages containing document file, please check the example provided below. 

Parameter

Type

Description

text

string

Name of the file that will be sent.

fileUrl

string

URL of the file sent

Code Block
{
    "scenarioKey": "CC9F01A5DC7BEE2C2B829D203482A654",
    "destinations": [
        {
            "to": {
                "phoneNumber": "41793026727"
            }
        }
    ],
    "whatsApp": {
        "text": "File caption",
        "fileUrl": "https://www.documentUrl.com"
    }
}	

Delivery Message

CTLive can be informed about the delivery status of outbound messages posting the following URL https://<hostname>/imchanne/message

...

Template text message  

If you would like to send a template text message, please check the example provided below. 

Code Block
languagejson
{
    "results": [{
        scenarioKey": "CC9F01A5DC7BEE2C2B829D203482A654",
    "destinations": [
        {
            "to": {
                "phoneNumber": "41793026727"
            }
        }
    ],
    "whatsApp": {
        "templateName ": "template_5",
        "templateData ": ["John", "5"],
        "language" : "en_GB"
    }
}

Template image message

If you would like to send a template image message, please check the example provided below. 

Code Block
languagejson
{
    "scenarioKey": "CC9F01A5DC7BEE2C2B829D203482A654",
    "destinations": [
        {
            "to": {
                "phoneNumber": "41793026727"
            }
        }
    ],
    "whatsApp": {
        "templateName ": "template_5",
        "mediaTemplateData" : {
          "header": {
            "imageUrl": "https://url_to_download_image"
          },
          "body": {
            "placeholders": ["John", "5"]
          }
        },
        "language" : "en_GB"
    }
}

Template document message

If you would like to send a template document message, please check the example provided below. 

Code Block
languagejson
{
    "scenarioKey": "CC9F01A5DC7BEE2C2B829D203482A654",
    "destinations": [
        {
            "to": {
                "phoneNumber": "41793026727"
            }
        }
    ],
    "whatsApp": {
        "templateName ": "template_5",
        "mediaTemplateData" : {
          "header": {
            "documentUrl": "https://url_to_download_document",
            "documentFilename": "myFile.pdf"
          },
          "body": {
            "placeholders": ["John", "5"]
          }
        },
        "language" : "en_GB"
    }
}

Delivery Message

CTLive can be informed about the delivery status of outbound messages posting the following URL https://<hostname>/imchannel/message

Code Block
{
    "results": [{
        "bulkId": "",
        "status": {
            "id": 5,
            "groupId": 3,
            "groupName": "DELIVERED",
            "name": "DELIVERED_TO_HANDSET",
            "description": "Message delivered to handset"
        },
        "messageId": "fb469d73-d362-463f-b30f-1e959b53badc",
        "doneAt": "2019-04-09T16:01:56.494-0300",
        "sentAt": "2019-04-09T16:00:58.647-0300",
        "to": "41793026731",
        "channel": "WHATSAPP"
    }]
}	

...

CTLive can be informed about the seen status of outbound messages posting the following URL https://<hostname>/imchanneimchannel/message

Code Block
{
    "results": [
        {
            "messageId": "1215f543ab19-345f-adbd-12ad31451ed25f35",
            "to": "41793026731",
            "sentAt": "2018-12-12T11:21:57.793+0000",
            "seenAt": "2018-12-12T11:21:58.251+0000"
        }
    ]
}