Send a message to a UserChat

Send a new message to a chat via bot

Parameter

Accessible via URL https://api.channel.io/open/v3/user-chats/{userChatId}/messages and HTTP POST

📘

Present message parameters in POST body. This method does currently accept application/json only.

Parameter

Example

Required

Description

Parameter type

userChatId

5e65fa8bc2409f0c1fd3

Required

ID of UserChat

Path

message

Hello bot

Required

a message

Body

botName

channelBot

Required

Name of Bot

Path

botOption.actAsManager

false

Optional

Even if this options is true, UserChat is no longer updated from 'unassigned' to 'assigned' state. Default is false.

Body

botOption.silentToManager (Deprecated)

true

Optional

Has no action.

Body

form

Optional

a object represnts actionable message

Body

Example

POST https://api.channel.io/open/v3/user-chats/5e65fa8bc2409f0c1fd3/messages?botName=channelBot

Request

Your POST body should look like below

{
    "blocks": [
        {
            "type": "text",
            "value": "This is <b>bold</b>, <i>italic</i>, and <b><i>bold+italic</i></b>"
        },
        {
            "type": "text",
            "value": "<link type=\"manager\" value=\"managerId_goes_here\">@username</link>"
        },
        {
            "type": "text",
            "value": "This is a url <link type=\"url\" value=\"https://channel.io\">https://channel.io</link>"
        },
        {
            "type": "text",
            "value": "This is a link <link type=\"url\" value=\"https://channel.io\">Channel</link>"
        },
        {
            "type": "code",
            "value": "<script>ChannelIO('boot')</script>"
        },
        {
            "type": "bullets",
            "blocks": [
                {
                    "type": "text",
                    "value": "Bulleted text goes here"
                },
                {
                    "type": "text",
                    "value": "Next bulleted text goes here"
                }
            ]
        }
    ],
    "plainText": "String",
    "options": [
        "actAsManager",
        "doNotPost",
        "doNotSendApp",
        "immutable",
        "quiet",
        "private"
    ],
    "action": {
        "type": "select",
        "buttons": [
            {
                "key": "chicken",
                "text": "I like chicken better than pizza"
            },
            {
                "key": "pizza",
                "text": "I like pizza better than chicken"
            }
        ]
    }
}

Response

Return a newly created message object.

{
  "message": {
    "chatKey": "userChat-5e7049961ece389ba6ac",
    "id": "5e89f000d0408cf81880",
    "channelId": "10",
    "chatType": "userChat",
    "chatId": "5e7049961ece389ba6ac",
    "personType": "bot",
    "personId": "10598",
    "createdAt": 1586098176853,
    "version": 1,
    "blocks": [
      {
        "type": "text",
        "value": "String"
      }
    ],
    "plainText": "String"
  }
}