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


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).


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.


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


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


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

profile.firstNameOptional first name of the user
profile.lastNameOptional last name of the user
profile.fullNameOptional first and last name combined
profile.pictureOptional profile picture
profile.localeOptional user language
tagsA list of (optional) tags applied


The match object will contain the matched step and flow.