Create Message - Early Access

Resource

https://api.infobip.com/ccaas/1/conversations/{conversationId}/messages

Path Params

Inbound messages are automatically threaded if the channels and senders are configured for conversation threading. To add outbound messeges to a conversation use this method with the following parameters.

Name Type Description
*conversationId string Required - Conversation Id to set message to

Body Params

Name Type Description
*from string Required - Sender telephone number or FacebookMessengerId message is sending from
*to string Required - Destination telephone number message is sending to
*channel string Required - Selected channel to send the message (SMS, VIBER, FACEBOOK_MESSENGER, WHATSAPP)
*contentType string Required - Type of message content (TEXT, IMAGE, LOCATION, TEMPLATE, AUDIO, VIDEO, DOCUMENT, CONTACT).
*content object Required - Content of message is object dependent on content type. Summary it can be up to 1000 characters. Content limits are channel dependent. See length info for SMS

 

Request Example

					POST /ccaas/1/conversations/9F1F21C198025CC026956A7E2E9C560F/messages HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/json

{
    "from":"447492263897",
    "to":"44776333666",
    "channel":"SMS",
    "contentType":"TEXT",
    "content":{
        "text":"Dear customer, thank's for everything."
    }
}
					
				

Response

					{
    "id": "107AB921757DEAC9BE79EC6259B31C8A",
    "from": "447492263897",
    "to": "44776333666",
    "channel": "SMS",
    "direction": "OUTBOUND",
    "conversationId": "9F1F21C198025CC026956A7E2E9C560F",
    "createdAt": "2019-10-14T09:45:57.898+0000",
    "updatedAt": "2019-10-14T09:45:57.898+0000",
    "contentType": "TEXT",
    "content": {
        "text": "Dear customer, thank's for everything."
    }
}
					
				
					{
  "statusCode": "ERROR",
  "message": "Invalid id '9F1F21C198025CC026956A7E2E9C560F' given! No such entity exists."
}
					
				
					{
    "statusCode": "ERROR",
    "message": "Required request body is missing or not valid"
}
					
				

Additional Examples:

Request example:
Sending WHATSAPP message with IMAGE content.

POST /ccaas/1/conversations/9F1F21C198025CC026956A7E2E9C560F/messages HTTP/1.1 Host: {base_url} Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== Accept: application/json

{
    "from":"447492263897",
    "to":"44776333666",
    "channel":"WHATSAPP",
    "contentType":"IMAGE",
    "content":{
        "url":"https://www.infobip.com/assets/uploads/media_kit/logo_pack.jpg"
    }
}	
  

Response:

{
    "id": "107AB921757DEAC9BE79EC6259B31C8A",
    "from": "447492263897",
    "to": "44776333666",
    "channel": "WHATSAPP",
    "direction": "OUTBOUND",
    "conversationId": "9F1F21C198025CC026956A7E2E9C560F",
    "createdAt": "2019-10-14T09:45:57.898+0000",
    "updatedAt": "2019-10-14T09:45:57.898+0000",
    "contentType": "IMAGE",
    "content": {
        "caption": null,
        "url":"https://www.infobip.com/assets/uploads/media_kit/logo_pack.jpg"
    }
}	
  

Request example:
Sending VIBER message with LOCATION content.

POST /ccaas/1/conversations/9F1F21C198025CC026956A7E2E9C560F/messages HTTP/1.1 Host: {base_url} Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== Accept: application/json

{
    "from":"DemoCompany",
    "to":"44776333666",
    "channel":"VIBER",
    "contentType":"LOCATION",
    "content":{
        "longitude": 44.9524649,
        "latitude": 13.853767,
        "locationName": "Infobip campus",
        "address": "Istarska ul. 157, 52215, Vodnjan, Croatia"
    }
}	
  

Response:

{
    "id": "107AB921757DEAC9BE79EC6259B31C8A",
    "channel": "VIBER",
    "from": "DemoCompany",
    "to": "44776333666",
    "direction": "OUTBOUND",
    "conversationId": "9F1F21C198025CC026956A7E2E9C560F",
    "createdAt": "2019-10-14T11:11:52.294+0000",
    "updatedAt": "2019-10-14T11:11:52.294+0000",
    "content": {
        "latitude": 44.9524649,
        "longitude": 13.853767,
        "locationName": "Infobip campus",
        "address": "Istarska ul. 157, 52215, Vodnjan, Croatia"
    },
    "contentType": "LOCATION"
}	
  

Request example:
Sending WHATSAPP message with DOCUMENT content.

POST /ccaas/1/conversations/9F1F21C198025CC026956A7E2E9C560F/messages HTTP/1.1 Host: {base_url} Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== Accept: application/json

{
    "from":"447492263897",
    "to":"44776333666",
    "channel":"WHATSAPP",
    "contentType":"DOCUMENT",
    "content":{
        "url": "https://file-examples.com/wp-content/uploads/2017/02/file-sample_100kB.doc"
    }
}	
  

Response:

{
    "id": "107AB921757DEAC9BE79EC6259B31C8A",
    "from": "447492263897",
    "to": "44776333666",
    "channel": "WHATSAPP",
    "direction": "OUTBOUND",
    "conversationId": "9F1F21C198025CC026956A7E2E9C560F",
    "createdAt": "2019-10-14T09:45:57.898+0000",
    "updatedAt": "2019-10-14T09:45:57.898+0000",
    "contentType": "DOCUMENT",
    "content": {
        "caption": null,
        "url": "https://file-examples.com/wp-content/uploads/2017/02/file-sample_100kB.doc"
    }
}	
  

Request example:
Sending WHATSAPP message with VIDEO content.

POST /ccaas/1/conversations/9F1F21C198025CC026956A7E2E9C560F/messages HTTP/1.1 Host: {base_url} Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== Accept: application/json

{
    "from":"447492263897",
    "to":"44776333666",
    "channel":"WHATSAPP",
    "contentType":"VIDEO",
    "content":{
        "url": "https://file-examples.com/wp-content/uploads/2018/04/file_example_AVI_480_750kB.avi"
    }
}	
  

Response:

{
    "id": "107AB921757DEAC9BE79EC6259B31C8A",
    "from": "447492263897",
    "to": "44776333666",
    "channel": "WHATSAPP",
    "direction": "OUTBOUND",
    "conversationId": "9F1F21C198025CC026956A7E2E9C560F",
    "createdAt": "2019-10-14T09:45:57.898+0000",
    "updatedAt": "2019-10-14T09:45:57.898+0000",
    "contentType": "VIDEO",
    "content": {
        "caption": null,
        "url": "https://file-examples.com/wp-content/uploads/2018/04/file_example_AVI_480_750kB.avi"
    }
}	
  

Request example:
Sending WHATSAPP message with AUDIO content.

POST /ccaas/1/conversations/9F1F21C198025CC026956A7E2E9C560F/messages HTTP/1.1 Host: {base_url} Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== Accept: application/json

{
    "from":"447492263897",
    "to":"44776333666",
    "channel":"WHATSAPP",
    "contentType":"AUDIO",
    "content":{
        "url":"https://file-examples.com/wp-content/uploads/2017/11/file_example_MP3_700KB.mp3"
    }
}	
  

Response:

{
    "id": "107AB921757DEAC9BE79EC6259B31C8A",
    "from": "447492263897",
    "to": "44776333666",
    "channel": "WHATSAPP",
    "direction": "OUTBOUND",
    "conversationId": "9F1F21C198025CC026956A7E2E9C560F",
    "createdAt": "2019-10-14T09:45:57.898+0000",
    "updatedAt": "2019-10-14T09:45:57.898+0000",
    "contentType": "AUDIO",
    "content": {
        "url":"https://file-examples.com/wp-content/uploads/2017/11/file_example_MP3_700KB.mp3"
    }
}	
  

Request example:
Sending WHATSAPP message with TEMPLATE content on spanish language filled with one expected parameter ("Pablo").

POST /ccaas/1/conversations/9F1F21C198025CC026956A7E2E9C560F/messages HTTP/1.1 Host: {base_url} Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== Accept: application/json

{
    "from": "447492263897",
    "to": "44776333666",
    "channel": "WHATSAPP",
    "contentType": "TEMPLATE",
    "content": {
        "templateName": "welcome_multiple_languages",
        "language": "es",
        "parameters": [{
            "default": "Pablo"
        }]
    }    
}	
  

Response:

{
    "id": "107AB921757DEAC9BE79EC6259B31C8A",
    "from": "447492263897",
    "to": "44776333666",
    "channel": "WHATSAPP",
    "direction": "OUTBOUND",
    "conversationId": "9F1F21C198025CC026956A7E2E9C560F",
    "createdAt": "2019-10-14T11:06:11.052+0000",
    "updatedAt": "2019-10-14T11:06:11.052+0000",
    "contentType": "TEXT",
    "content": {
        "text": "Hola Pablo! Bienvenido a nuestro canal en WhatsApp. Responda \"Sí\" si desea continuar esta conversación."
    }
}	
  

Whatsapp template response

Response from sending Whatsapp template is TEXT content type message, with original template text content filled with parameters.