message

This endpoint can be used to send messages to a particular user.

Request

url

`http://api.morph.ai/v1/message\`

Method: POST

Header
If you don't have access token you can get from here.

Authorization: ACCESS TOKEN  
Content-Type: application/json

Body

{
    "user_id": "INSERT_USER_ID_HERE",
    "bot_id": "INSERT_BOT_ID_HERE",
    "messages": [
        {
            "type": "statement",
            "text": "Here is a sample response to user"
        }
    ]
}
Property Description Required
user_id The user_id of the user to whom you want to send the message to. This is also received along with the message to the webhook. Y
bot_id The bot_id representing the id of the deployed bot. Recieved along with the message to the webhook Y
messages An array containing message object Y

message object

Message object has different attributes based on the message type. The type of the message can be one of the following:

statement

Represents a text message

Property Description Required
type value=statement Y
text The text to publish Y
buttons An array of Button objects N
suggestionElements An array of Suggestion Object N

Example object:

{
    "type": "statement",
    "text": "Here is a sample response to user",
    "buttons": [
        {
            "title": "INSERT BUTTON DISPLAY NAME",
            "url": "INSERT LINK URL HERE",
            "buttonType": "URL",
            "webviewHeightRatio": "TALL"
        },
        {
            "title": "INSERT BUTTON DISPLAY NAME",
            "payload": "PAYLOAD HERE",
            "buttonType": "POSTBACK"
        }
    ],
    "suggestionElements": [
        {
            "title": "Quick Reply Title",
            "payload": "Quick Reply payload",
            "imageUrl": "icon url"
        }
    ]
}
Property Description Required
type value=carousel Y
carousalElements An array of CarousalElement objects Y
suggestionElements An array of Suggestion Object N

Example object:

{
    "type": "carousel",
    "carousalElements": [
        {
            "title": "Element Title here",
            "subtitle": "Element Subtitle here",
            "imageUrl": "Image URL here",
            "clickUrl": "Click URL here",
            "buttons": [
                {
                    "title": "INSERT BUTTON DISPLAY NAME",
                    "url": "INSERT LINK URL HERE",
                    "buttonType": "URL",
                    "webviewHeightRatio": "TALL"
                },
                {
                    "title": "INSERT BUTTON DISPLAY NAME",
                    "payload": "PAYLOAD HERE",
                    "buttonType": "POSTBACK"
                }
            ]
        }
    ],
    "suggestionElements": [
        {
            "title": "Quick Reply Title",
            "payload": "Quick Reply payload",
            "imageUrl": "icon url"
        }
    ]
}
list
Property Description Required
type value=list Y
carousalElements An array of CarousalElement objects Y
suggestionElements An array of Suggestion Object N

Example object:

{
    "type": "carousel",
    "carousalElements": [
        {
            "title": "Element Title here",
            "subtitle": "Element Subtitle here",
            "imageUrl": "Image URL here",
            "cover" : true,
            "buttons": [
                {
                    "title": "INSERT BUTTON DISPLAY NAME",
                    "url": "INSERT LINK URL HERE",
                    "buttonType": "URL",
                    "webviewHeightRatio": "TALL"
                }
            ]
        }
    ],
    "suggestionElements": [
        {
            "title": "Quick Reply Title",
            "payload": "Quick Reply payload",
            "imageUrl": "icon url"
        }
    ]
}
media
Property Description Required
type value=media Y
mediaUrl The public URL of the media Y
mediaType Either "image" or "video" Y

Example object:

{
    "type": "media",
    "mediaUrl": "Insert Media URL",
    "mediaType": "image"
}
receipt
Property Description Required
type value=receipt Y
baseData The public URL of the media Y
adjustments An array of adjustments object N
elements An array of receipt elements object Y

Example object:

{
    "type": "receipt",
    "baseData": {
        "uNm": "User Name",
        "mrtNm": "Merchent Name",
        "oNo": "#AA11002 (Order Number)",
        "crncy": "USD",
        "pMtd": "Payment Method",
        "oUrl": "Order URL",
        "loc": {
            "locationType": "office",
            "houseNo": "B-205",
            "street": "Sohna Road",
            "locality": "Sispal Vihar",
            "city": "Gurgaon",
            "state": "Haryana",
            "country": "India",
            "latitude": 22.44,
            "longitude": 180.33,
            "url": "SAMPLE URL",
            "address": "B-205, Sispal Vihar, Sohna Road",
            "postalCode": "122001",
            "placeId": "ABC123"
        },
        "sbTtl": 123.11,
        "spCst": 122.33,
        "ttlTx": 11.11,
        "ttlCst": 256.55
    },
    "adjustments": [
        {
            "nm": "Name",
            "amnt": 1.11
        }
    ],
    "elements": [
        {
            "ttl": "Title",
            "sbttl": "Subtitle",
            "qnty": 11,
            "prc": 111,
            "crncy": "USD",
            "imgUrl": "IMAGE URL"
        }
    ]
}

button object

Property Description Required
title Display Name of the button Y
buttonType Either POSTBACK or URL Y
url The link to open in case of URL button Y if URL button N otherwise
webviewHeightRatio Either FULL, COMPACT or TALL in case of URL button N
payload The payload of the button in case of POSTBACK button Y if POSTBACK button N otherwise

Suggestion Object

Property Description Required
title Display Name of the suggestion Y
suggestionType Either LOCATION or TEXT Y
payload The payload in case of TEXT type Y if TEXT type N otherwise
imageUrl The icon of the suggestion. Applicable only for TEXT type N

CarousalElement Object

Property Description Required
title Title of the Element Y
subtitle Subtitle of the Element N
imageUrl Image URL of the element N
clickUrl The URL to open when a click happens on that element N
buttons An array of Button object N

results matching ""

    No results matching ""