cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Code Actions: Payload

Code Actions: Payload

A code action is a single function that is called along with a payload. The payload contains metadata regarding the message and user that triggered the action.

/**
@param {object} payload - data and info
@param {string} payload.threadId - Identifier for the conversation
@param {string} payload.channelName - type of channel
@param {string} payload.query - what the user sends
@param {object} payload.params - data detected by AI
@param {object} payload.user - user that triggered the action
@param {string} payload.user.name - name of the user
@param {string} [payload.user.profile.firstName] - first name of the user
@param {string} [payload.user.profile.lastName] - Last name of the user
@param {string} [payload.user.profile.fullName] - first and last name combined
@param {string} [payload.user.profile.picture] - profile picture
@param {string} [payload.user.profile.locale] - user language
@param {string} [payload.user.profile.gender] - user gender
@param {object} payload.match - matching flow and step
@param {object} payload.match.flow - contains name and flowId of matching flow
@param {object} payload.match.step - contains name and stepId of matching step
*/
async payload => {
    // Your custom logic
}

threadId

The threadId is a unique identifier that represents the conversation. For some channels this identifier represents the user. For example, with Messenger this is the page specific ID (PSID).

channelName

With each call you als receive the type of channel. This is a simple string like socket, whatsapp or rcs.

API and webwidget

Both the Socket API and Web widget are the socket channel

query

Usually, an action is triggered by a user saying something or sending a text message. If so, this property will contain the query.

params

Params contain any data extracted by the AI engine, or that is send by other integrations or channels

user

This object contains profile information regarding the user triggering the Code action. Except for name, most profile information is optional.

Property Description
name  
profile.firstName Optional first name of the user
profile.lastName Optional last name of the user
profile.fullName Optional first and last name combined
profile.picture Optional profile picture
profile.locale Optional user language
tags A list of (optional) tags applied

match

The match object will contain the matched step and flow.

Labels (1)

Code Actions: Payload

A code action is a single function that is called along with a payload. The payload contains metadata regarding the message and user that triggered the action.

/**
@param {object} payload - data and info
@param {string} payload.threadId - Identifier for the conversation
@param {string} payload.channelName - type of channel
@param {string} payload.query - what the user sends
@param {object} payload.params - data detected by AI
@param {object} payload.user - user that triggered the action
@param {string} payload.user.name - name of the user
@param {string} [payload.user.profile.firstName] - first name of the user
@param {string} [payload.user.profile.lastName] - Last name of the user
@param {string} [payload.user.profile.fullName] - first and last name combined
@param {string} [payload.user.profile.picture] - profile picture
@param {string} [payload.user.profile.locale] - user language
@param {string} [payload.user.profile.gender] - user gender
@param {object} payload.match - matching flow and step
@param {object} payload.match.flow - contains name and flowId of matching flow
@param {object} payload.match.step - contains name and stepId of matching step
*/
async payload => {
    // Your custom logic
}

threadId

The threadId is a unique identifier that represents the conversation. For some channels this identifier represents the user. For example, with Messenger this is the page specific ID (PSID).

channelName

With each call you als receive the type of channel. This is a simple string like socket, whatsapp or rcs.

API and webwidget

Both the Socket API and Web widget are the socket channel

query

Usually, an action is triggered by a user saying something or sending a text message. If so, this property will contain the query.

params

Params contain any data extracted by the AI engine, or that is send by other integrations or channels

user

This object contains profile information regarding the user triggering the Code action. Except for name, most profile information is optional.

Property Description
name  
profile.firstName Optional first name of the user
profile.lastName Optional last name of the user
profile.fullName Optional first and last name combined
profile.picture Optional profile picture
profile.locale Optional user language
tags A list of (optional) tags applied

match

The match object will contain the matched step and flow.

Labels (1)
Last Reviewed:
02-03-2022 08:42 PM

Code Actions: Payload

A code action is a single function that is called along with a payload. The payload contains metadata regarding the message and user that triggered the action.

/**
@param {object} payload - data and info
@param {string} payload.threadId - Identifier for the conversation
@param {string} payload.channelName - type of channel
@param {string} payload.query - what the user sends
@param {object} payload.params - data detected by AI
@param {object} payload.user - user that triggered the action
@param {string} payload.user.name - name of the user
@param {string} [payload.user.profile.firstName] - first name of the user
@param {string} [payload.user.profile.lastName] - Last name of the user
@param {string} [payload.user.profile.fullName] - first and last name combined
@param {string} [payload.user.profile.picture] - profile picture
@param {string} [payload.user.profile.locale] - user language
@param {string} [payload.user.profile.gender] - user gender
@param {object} payload.match - matching flow and step
@param {object} payload.match.flow - contains name and flowId of matching flow
@param {object} payload.match.step - contains name and stepId of matching step
*/
async payload => {
    // Your custom logic
}

threadId

The threadId is a unique identifier that represents the conversation. For some channels this identifier represents the user. For example, with Messenger this is the page specific ID (PSID).

channelName

With each call you als receive the type of channel. This is a simple string like socket, whatsapp or rcs.

API and webwidget

Both the Socket API and Web widget are the socket channel

query

Usually, an action is triggered by a user saying something or sending a text message. If so, this property will contain the query.

params

Params contain any data extracted by the AI engine, or that is send by other integrations or channels

user

This object contains profile information regarding the user triggering the Code action. Except for name, most profile information is optional.

Property Description
name  
profile.firstName Optional first name of the user
profile.lastName Optional last name of the user
profile.fullName Optional first and last name combined
profile.picture Optional profile picture
profile.locale Optional user language
tags A list of (optional) tags applied

match

The match object will contain the matched step and flow.

Labels (1)
Version history
Last update:
‎06-17-2021 05:21 AM
Updated by:
Contributors