Supported activities and events

Here you will find 2 sets of supported activities (globally supported activities and partially supported activities).

Common activities across channels:

Specific activities for some channels:

Not all of these activities work on all channels. For example, Facebook only supports some activities. Whatsapp only supports basic text.

ActivityWebChatFacebookWhatsAppAppleVKontakte

Facebook = Facebook Messenger Apple = Apple Messages for Business

Activities

The way how to send an activity varies depending on the type of chatbot:

GetAvailableOperators

This gets a list of operators that are logged in and available.

If the groupId parameter is set, and a list of available operators from the selected group is returned.

Otherwise (groupId isn't set), the routing conditions are re-evaluated and only a list of available operators from the groups that meet the conditions is returned. It is therefore possible to change the session parameters and get a list of available operators according to the current parameters.

Request JSON:

{
  "sessionId": <mandatory for API chatbot only>,
  "activity": "GetAvailableOperators",
  "groupId: <Group id is optional>
}

Response:

{
  "sessionId": <mandatory for API chatbot only>,
  "activity": "GetAvailableOperatorsResponse",
  "availableOperators": [
    {
        "displayName":"Katka",
        "userId":1
    },
    {
        "displayName":"Tomáš",
        "userId":2
    }
  ]
}

GetAvailableGroups

This gets a list of operator groups and their current status.

If the groupIds field is defined, and a list of groups according to this field is returned.

Otherwise, the routing conditions are re-evaluated and a list of groups that meet the conditions is returned. It is therefore possible to change the session parameters and get a list of available operators according to the current parameters.

Group status can have these values:

  • ONLINE - a group has available operators

  • BUSY - all operators are busy but the group queue is not full

  • OFFLINE - group queue is full

In addition, when group is offline, the groupOfflineReasons array is populated with the following values:

  • BUSINESS_HOURS - the group is outside configured business hours

  • NO_OPERATORS - there are logged-in operators in the group

  • QUEUE_FULL - the group has reached the maximum configured queue size

  • DELETED - the group was deleted by an administrator

  • CHANNEL_BLOCKED - all operators have blocked the given channel

Request JSON:

{
  "sessionId": <mandatory for API chatbot only>,
  "activity": "GetAvailableGroups",
  "groupIds: <optional field>
}

Response:

groupWorkload

  • maxSlots: Sum of all slots of logged operators in group

  • usedSlotsWaiting: Sum of all waiting slots of logged operators in group

  • usedSlotsAccepted: Sum of all accepted slots of logged operators in group

  • freeSlots: Sum of free slots of logged operators in group

queueWorkload

  • freeQueueSlotsCountTotal: Free queue slots of group

  • inQueueCountTotal: Used queue slots of group

  • isQueueFull: freeQueueSlotsCountTotal == 0

{
  "sesionId": <mandatory for API chatbot only>,
  "activity": "GetAvailableGroupsResponse",
  "availableGroups": [
    {
        "displayName":"Group one",
        "groupId": int,
        "groupState": one of: ONLINE, OFFLINE, BUSY,
        "groupOfflineReasons": [zero or more of: BUSINESS_HOURS, NO_OPERATORS, QUEUE_FULL, DELETED, CHANNEL_BLOCKED],
        "groupWorkload": {
          "maxSlots": int,
          "usedSlotsWaiting": int,
          "usedSlotsAccepted": int,
          "freeSlots": int
        },
        "queueWorkload": {
          "freeQueueSlotsCountTotal": int,
          "inQueueCountTotal": int,
          "isQueueFull": boolean,
        }
    }
  ]
}

GetCallParams

Acquires CallParams associated with an active session.

Request JSON:

{
  "sessionId": <mandatory for API chatbot only>,
  "activity": "GetCallParams"
}

Response:

{
  "sessionId": <mandatory for API chatbot only>,
  "activity": "GetCallParamsResponse",
  "callParams": <dictionary>
}

SetCallParams

Set CallParams to active session.

Request JSON:

{
  "sessionId": <mandatory for API chatbot only>,
  "activity": "SetCallParams",
  "callParams": <dictionary>
}

Response:

{
  "sessinId": <mandatory for API chatbot only>,
  "activity": "SetCallParamsResponse",
  "success": <boolean>,
  "errorMessage": <string>
}

SendGuestOfflineEmail

Sends an email to an address for messages from an offline form. The offline form has to be set on a widget level.

Request JSON:

{
  "sessionId": <mandatory for API chatbot only>,
  "activity": "SendGuestOfflineEmail",
  "subject": <string>,
  "message": <string>,
  "location": <string> (message source for distinction, e.g.: "Chatbot Mluviik")
}

GetGuestIdentity

Gets properties from client identity.

Request JSON:

{
  "sessionId": <mandatory for API chatbot only>,
  "activity": "GetGuestIdentity"
}

Response:

{
  "sessionId": <mandatory for API chatbot only>,
  "activity": "GetGuestIdentityResponse",
  "trackedGuestGuid": <Guid>, (unique identifier from cookie)
  "phoneCallerId": <string>, (phone number)
  "facebookPSID": <string>, (facebook identifier)
  "facebookPageId": <string>, (facebook page identifier)
  "whatsAppContactId": <string>, (whatsapp identifier)
  "vkContactId": <string>, (vk identifier)
  "AppleContactId": <string>, (apple identifier)
}

Forward

Redirects interaction for a live operator. Either operatorGroupId or userId must be set.

Forwarded sessions ignore configured capacity rules (group queue limit/operator slots. If this is not desirable either handle the capacity manually using GetAvailableOperators / GetAvailableGroups or use HandOff activity instead.

Routing parameters are not re-evaluated. If you want to route the session again (for example after changing the session parameters), you can use the HandOff activity.

Request JSON:

{
  "sessionId": <mandatory for API chatbot only>,
  "activity": "Forward",
  "operatorGroupId": <integer:optional if userId is set>,
  "userId": <integer:optional if operatorGroupId is set>
}

HandOff

This returns the interaction to routing and re-evaluates the session parameters. After calling this activity, the chatbot is disconnected from the session. Therefore, we recommend that you first determine the availability of target operators/groups using the GetAvailableOperators / GetAvailableGroups activities.

The result of the Handoff operation depends on the state of the group:

  • ONLINE - a session is assigned to an operator

  • BUSY - a session goes to the group queue

  • OFFLINE - an offline form is displayed to a client

It is necessary to set the routing conditions to avoid routing back to the chatbot.

Example of correct use:

SequenceTargetCondition

1

Group "Sales"

HandoffReason = Sales

2

Group "Complaint"

HandoffReason = Complaint

3

Chatbot

no condition

4

Fallback - turned off

-

Firstly, the chatbot is selected on the first routing because the HandoffReason is not set yet. Chatbot should set this parameter using the SetCallParams activity before returning the session to routing. This ensures that the session is not routed back to the chatbot.

{
  "sessionId": <mandatory for API chatbot only>,
  "activity": "HandOff"
}

EndConversation

It ends a session.

{
  "sessionId": <mandatory for API chatbot only>,
  "activity": "EndConversation",
}

Typing

It displays/hides an "unfinished" message from a chatbot.

Request JSON:

{
  "sessionId": <mandatory for API chatbot only>,
  "activity": "typing",
  "show": true
}

DisableGuestInput

Hides the input field and allows typing into the chat for a client.

Request JSON:

{
  "sessionId": <mandatory for API chatbot only>,
  "activity": "DisableGuestInput",
}

Response:

{
  "sessionId": <mandatory for API chatbot only>,
  "activity": "GuestInputChangeResponse",
  "success": <bool>,
  "language": <string>,
  "source": <string>
}

EnableGuestInput

Displays the text input and allows typing into a chat for a client.

Request JSON:

{
  "sessionId": <mandatory for API chatbot only>,
  "activity": "EnableGuestInput",
}

Response:

{
  "sessionId": <mandatory for API chatbot only>,
  "activity": "GuestInputChangeResponse",
  "success": <bool>,
  "language": <string>,
  "source": <string>
}

GetHeroCards

Returns available Hero cards.

Request JSON:

{
  "activity": "GetHeroCards"
}

Response:

{
  "activity": "GetHeroCardsResponse",
  "heroCards": [
    {
        "displayName":"Hero card one",
        "heroCardId":1
    },
    {
        "displayName":"Hero card two",
        "heroCardId":2
    }
  ]
}

GetHeroCardsResponse returns HeroCards that can be used in the current session only.

SendHeroCard

Send selected hero card to client chat. To set predefined values in a HeroCard you can use object initialParams.

Examples:

  1. If you want to send a hero card with a text field that sets values in the call parameter "call_param_fullname", initialParams should look like the following:

initialParams: {
  "call_param_fullname": "predefined value"
}
  1. If you wish to send a hero card with a time picker ranging from 6th of December 2021 2:00 pm to 2:30 pm and from 7th of December 2021 8:00 am to 9:00 am and store the selected value to call parameter "call_param_time_picker", initialParams should look like the following (using military time):

initialParams: {
  "call_param_time_picker": "[
    { \"startTime\": \"2021-12-06T14:00\", \"endTime\": \"2021-12-06T14:30\"}, 
    { \"startTime\": \"2021-12-07T08:00\", \"endTime\": \"2021-12-07T09:00\"}
  ]"
}
  1. If you want to send a WhatsApp HeroCard with params, additional params should look like this:

Note that you should not change the header, buttons, footer, and body names, just add or remove values in an array. If you don't have any parameters in section, send an empty array.

"additionalParams": {"header": [], "buttons": [], "footer": [], "body": ["a", "b", "c", "d", "e"]}

Request JSON:

{
  "sessionId": <mandatory for API chatbot only>,
  "activity": "SendHeroCard",
  "heroCardId": <integer:required>,
  "selectedLanguage": <string: optional>
  "initialParams": <dictionary<string, string>: optional>,
  "additionalParams": <dictionary<string,string[]>: optional>
}
selectedLanguage string should be in format "cs", "en", "de" etc.

Response:

{
  "activity": "SendHeroCardResponse",
  "success": <boolean>,
  "errorMessage": <string>
}

Until recently, the chatbot was unable to detect that a Hero Card confirmation had occurred by the client and was reliant on tracking the session parameter change. This is no longer necessary as confirmation information can be obtained via webhook.

HeroCardSubmission

Information for the chatbot that the client has confirmed the Hero Card or selected one of the options (applies to WhatsApp).

{
  "activity": "HeroCardSubmission",
  "params": {
    "oo1_guest_ident": "Test"
  },
  "sessionId": 23647,
  "language": "cs",
  "source": "Default"
}

ChatbotOpenFileUploadPrompt

Opens a dialog box to allow the user to upload the file.

Request JSON:

{
  "sessionId": <mandatory for API chatbot only>,
  "activity": "ChatbotOpenFileUploadPrompt"
}

Response:

{
  "activity": "ChatbotOpenFileUploadPromptResponse",
  "fileUrl": <string | null>, (file URL uploaded by guest),
  "canceledByGuest": <boolean> (true, if guest canceled file upload prompt)
}

EnableGuestUpload

Enable functions that allow user file upload.

Request JSON:

{
  "activity": "EnableGuestUpload"
}

Response:

{
  "activity": "EnableGuestUploadResponse",
  "success": <boolean>,
  "errorMessage": <string>
}

DisableGuestUpload

Disable functions that allow user file upload.

Request JSON:

{
  "activity": "DisableGuestUpload"
}

Response:

{
  "activity": "DisableGuestUploadResponse",
  "success": <boolean>,
  "errorMessage": <string>
}

GetMediaObjects

Gets a list of files stored in mluvii and available for the given session.

Request JSON:

{
  "sessionId": <mandatory for API chatbot only>,
  "activity": "GetMediaObjects"
}

Response:

{
  "activity": "GetMediaObjectsResponse",
  "fileStoreItems": [
    {
      "id": <integer>,
      "name": <string>
    }
  ],
  "sessionId": <integer>,
  "language": <string>,
  "source": <string>
}

ShareFile

Sends file to chat. It can be done in two ways:

ShareFile (file name)

a) Combination of GetMediaObjects, which is used to get a list of all files stored in Files /name + id). In the second step, you use the name of the specific file within the ShareFile activity.

Example: Request JSON using name parameter:

{
  "sessionId": <mandatory for API chatbot only>,
  "activity": "ShareFile",
  "name": <string obtained via GetMediaObjects>
}

ShareFile (URL)

Using ShareFile activity with URL of the particular file hosted externally.

Request JSON using url parameter:

{
  "sessionId": <mandatory for API chatbot only>,
  "activity": "ShareFile",
  "url": <string>
}

Response:

{
  "activity": "ShareFileResponse",
  "isSuccess": <boolean>,
  "errorMessage": <string>,
  "fileSource": "<string>",
  "sessionId": <integer>,
  "language": <string>,
  "source": <string

If you want to send a YouTube video URL to the chat, use the "message" type and put the URL in "text".

There are two ways of sending a file - either with GetMediaObjects using a name or you can use a URL link to the specified file.

Allowed file types

You can whitelist file types on the company level - this overview specifies which files are working in which channel. For example, sending and playing mp3 files is working for WhatsApp but not for Facebook sessions.

File typeWebChatFacebook MessengerWhatsAppApple Messages for BusinessVKontakte

WAV

MP3

MP4

JPG

PNG

GIF

PDF

TXT

Adaptive cards

Our API supports https://adaptivecards.io standard for message formatting.

Example of a carousel adaptive card:

{
  "sessionId": <mandatory for API chatbot only>,
  "type": "message",
  "timestamp": "2020-06-12T12:13:39.7593384+02:00",
  "attachmentLayout": "carousel",
  "attachments": [
    {
      "contentType": "application/vnd.microsoft.card.hero",
      "content": {
        "title": "Street #1",
        "subtitle": "1. Street Foo 254 Czechia",
        "images": [
          {
            "url": "https://dev.virtualearth.net/REST/V1/Imagery/Map/Road?form=BTCTRL&mapArea=49.7463607788086,13.1083498001099,49.7932815551758,13.1951398849487&mapSize=500,280&pp=49.7616882324219,13.1491804122925;1;1&dpi=1&logo=always&key=ApBn8xoItlENbFx-rr1kzt_JakWdFTH24taCasYxQCgit15NtDeYrztO4chDtrg5"
          }
        ],
        "buttons": [
          {
            "type": "imBack",
            "title": "Street Foo 254",
            "value": 1
          }
        ]
      }
    },
    {
      "contentType": "application/vnd.microsoft.card.hero",
      "content": {
        "title": "Street #2",
        "subtitle": "1. Ulice, Plzeň, Czechia",
        "images": [
          {
            "url": "https://dev.virtualearth.net/REST/V1/Imagery/Map/Road?form=BTCTRL&mapArea=49.7463607788086,13.1083498001099,49.7932815551758,13.1951398849487&mapSize=500,280&pp=49.7616882324219,13.1491804122925;1;1&dpi=1&logo=always&key=ApBn8xoItlENbFx-rr1kzt_JakWdFTH24taCasYxQCgit15NtDeYrztO4chDtrg5"
          }
        ],
        "buttons": [
          {
            "type": "imBack",
            "title": "Ulice, Plzeň, Czechia",
            "value": 1
          }
        ]
      }
    },
    {
      "contentType": "application/vnd.microsoft.card.hero",
      "content": {
        "title": "Street #2 again",
        "subtitle": "1. Ulice, Plzeň, Czechia",
        "images": [
          {
            "url": "https://dev.virtualearth.net/REST/V1/Imagery/Map/Road?form=BTCTRL&mapArea=49.7463607788086,13.1083498001099,49.7932815551758,13.1951398849487&mapSize=500,280&pp=49.7616882324219,13.1491804122925;1;1&dpi=1&logo=always&key=ApBn8xoItlENbFx-rr1kzt_JakWdFTH24taCasYxQCgit15NtDeYrztO4chDtrg5"
          }
        ],
        "buttons": [
          {
            "type": "imBack",
            "title": "Ulice, Plzeň, Czechia",
            "value": 1
          }
        ]
      }
    }
  ]
}

Buttons

Buttons can be sent using adaptive cards.

Request JSON:

{
  "type": "message",
  "timestamp": "2020-09-09T10:03:53.4976861+02:00",
  "attachments": [
    {
      "contentType": "application/vnd.microsoft.card.hero",
      "content": {
        "title": "Test buttons",
        "buttons": [
          {
            "type": "imBack",
            "title": "Title of the first button",
            "value": "Value of the first button"
          },
          {
            "type": "imBack",
            "title": "Title of the second button",
            "value": "Value of the second button"
          }
        ]
      }
    }
  ]
}

The response to the selected button (Button 2) is then a Text activity in the following format:

{
  "activity": "Text",
  "timestamp": "2020-12-04T16:12:57.172",
  "text": "Button 2",
  "sessionId": 13,
  "language": "cs",
  "source": "Facebook"
}

Events

Incoming Message

When a guest sends a text message to a chat, the following activity comes at the callback url:

{
  "sessionId": 1,
  "activity": "Text",
  "text": "Hello world"
}

Incoming File

If a guest uploads the file using a paper clip in the chat input, the following Activity comes to a bot in the following format.

{
  "activity": "GuestFileUpload",
  "fileUrl": <string>, (file URL loaded by a guest)
}

Last updated