Send chat message

This method allows you to send a downstream chat message which will be received by mobile devices with your chat application installed. You can send a message to one or multiple devices targeting them by Push Registration IDs.

Path Parameters


Parameters

Body Params

Name Description
applicationCode
required
PUSH Application Code you are using to send messages. Application Code is the application identifier which links your mobile application to the application profile created in Infobip Platform. It is required to insert the Application Code in Mobile Messaging SDK configuration once you implement it in your mobile application.

 

Body Parameters

 


Parameters

Body Params

Name Description

to
required

Object
Recipient destination address. Note that only Push Registration ID accepted for chat API as a destination.
text
required
String
The text of the message that will be sent.
author
optional
Object
Message author details. Described in table Author.
notificationOptions
optional
Object
JSON object that contains notification options. Described in table Notification Options.
customPayload
optional
Object
Extra information delivered with a notification. Formatted as a custom JSON object.

 

Author

 


 

Name Description

to
required

String
Unique identifier of the author.
firstName
optional
String
Author's first name.
lastName
optional
String
Author's last name.
middleName
optional
String
Author's middle name.
email
optional
String
Author's email.
gsm
optional
String
MSISDN in international format (Example: 41793026727)
data
optional
Object
Author's custom data. Formatted as custom JSON object.

 

Notification Options

 


 

Name Description

contentUrl

optional

String
URL of the image displayed in the notification. Rich push notifications are available on devices with iOS 10 and Android 4.1.+. Supported on iOS since MM SDK version 2.5.8. Supported on Android since MM SDK version 1.6.4.
category
optional
String
Category id for actionable notification. Supported on Android since MM SDK version 1.6.16. Supported on iOS since MM SDK version 2.6.9. Predefined category ids: mm_accept_decline - Accept & Decline button actions.

 

Request example

 


POST /push/1/applications/{applicationCode}/chat/message HTTP/1.1
Host: oneapi.infobip.com
Authorization: App applicationCode
Content-Type: application/json
{
   "to" : {
       "pushRegistrationId" : "3D7F797B-8841-4A95-9AAB-D529E94D6964"
   }, 
   "text": "Good morning!",
   "author" : {
       "firstName" : "Boris"
   }
}	
  

Response example


{
	"bulks": [{
		"to": {
			"pushRegistrationId": "3D7F797B-8841-4A95-9AAB-D529E94D6964"
		},
		"status": {
			"groupId": 1,
			"groupName": "PENDING",
			"id": 26,
			"name": "PENDING_ACCEPTED",
			"description": "Message accepted, pending for delivery"
		},
		"messageCount": 1,
		"bulkId": "e1sd58p7ptuxg8hg1qb4"
	}]
}	
  

Recipient destination address examples


Note: For chat API only Push Registration ID is supported as a destination for the message.

Use this method to target recipient's device associated with the single Push Registration ID:

{
	"to": {
		"pushRegistrationId": "3D7F797B-8841-4A95-9AAB-D529E94D6964"
	},
	...
}	
  

Use list of Push Registration IDs to target all associated devices:

{
	"to": {
		"pushRegistrationId": ["3D7F797B-8841-4A95-9AAB-D529E94D6964", "69827EDB-A806-4AF6-A7F6-98298EAA4F14"]
	},
	...
}