Custom Message

Hyphenate provides a custom message API that allows the admin to load a message editing page containing rich media messages on the Conversations page. The messages can be product introductions, order details, etc. Agents can send these messages to the customers.

To activate the custom message feature, go to “Admin Mode > Settings > System Settings”, and enter your custom message page URL in the Custom Message area.

Custom message

After you activate the custom message feature, a custom message button appears above the input box on the Conversations page.

Click the custom message button. The custom message page will appear in an Iframe window.

Edit a message in the Iframe window, and send it. The message will be sent to the customer and appear in the chat window.

Use Javascript to call the window.parent.postMessage(object, “*”) function to send a message. “object” is the message body in the json format. For details, see Message Format.

The message body is in the json format.

{
   "news": {
       "articles":[
           {
               "title": "Title",
               "description": "Description",
               "url": "URL",
               "picurl": "PIC_URL"
           },
           {
               "title": "Title",
               "description": "Description",
               "url": "URL",
               "picurl": "PIC_URL"
           }    
       ]
   }
}

Parameter Description

ParameterMandatoryDescription
articlesYesRich media messages. 1 to 10 rich media messages are supported
titleNoTitle of the message
descriptionNoDescription in the message
urlNoLink that directs to a webpage
picurlNoPicture link in the rich media message. The picture can be in the JPG or PNG format. Recommended sizes are 640*320 for a full picture and 80*80 for a fingernail. If omitted, no picture will be displayed in the rich media message.