Skip to content

Introduction to Chatbot Events

Stackchat generates events during your chatbot's conversations and routes them to the analytics provider you have configured. These events also show up in the Stackchat Studio logs screen.

Events

A typical event looks like this. For modern analytics platforms like Segment and Adobe Experience Platform, you can expect payloads to look very similar. For older solutions like Adobe Analytics, you must create custom mappings for these event fields in Stackchat Studio.

{
   "dt":"2021-06-30T19:13:04.767Z",
   "level":"debug",
   "message":"KEYWORD_MATCHED",
   "context":{
      "source":"bot",
      "appId":"feizsrdxcea30t",
      "botId":"jkn7dxaokgrn0d",
      "userId":"jd162d8c1118845c68a6dbc79adecc7a1",
      "conversationId":"1dwbqysmximgktk0k7m9n57yu9",
      "messageId":"kl2p8gtoa9sxlrt63lgi326oi84c"
   },
   "event":{
      "type":"KEYWORD_MATCHED",
      "data":{
         "channel_id":"sc-messenger",
         "keyword_matched_regex":"/^Yes\\ please\\!$/i",
         "keyword_nav_target":"FlowName:ElementName",
         "keyword_user_text":"Yes please!",
         "current_flow":"RoutingFlow",
         "current_element":"KeywordMappings"
      }
   }
}

All Chat Events

The full list of chat events and the data in their associated payloads are documented below:

Event Example Payload
TEXT_RECEIVED { current_element: 'bot-start', current_flow: 'bot-start', incoming_message_input_method: 'voice', incoming_message_type: 'text', incoming_message_value: 'hi' }
TEXT_MESSAGE_SENT { current_element: 'WelcomeMessageThread', current_flow: 'IntroFlow', outgoing_text_message: 'Welcome to this zany new chatbot.' }
IMAGE_MESSAGE_SENT { current_element: 'NormalSkinShop', current_flow: 'ShopperFlow' }
LIST_MESSAGE_SENT { current_element: 'NormalSkinShop', current_flow: 'ShopperFlow' }
FLOW_STARTED { current_element: 'WelcomeMessageThread', current_flow: 'IntroFlow' }
MESSAGE_THREAD_ENDED { current_element: 'WelcomeMessageThread', current_flow: 'IntroFlow' }
MESSAGE_THREAD_STARTED { current_element: 'WelcomeMessageThread', current_flow: 'IntroFlow', message_thread_name: 'WelcomeMessageThread' }
ACTION_SEQUENCE { action_type: 'clear_slots', clear_slot_action_name: 'Clear Values', cleared_slots: [ 'SkinType', 'SkinConcern', 'EmailCapture', 'DOB' ], current_element: 'ActionSequence', current_flow: 'RestartFlow' }
BRANCH_MATCH_EVENT { current_flow: 'Introduction', current_element: 'Need Ideas Branch' }
CLOUD_FUNCTION_END { current_element: 'SkinTypeRouting', current_flow: 'ProductResultsFlow', function_name: 'MyCloudFunction' }
CLOUD_FUNCTION_ERROR { current_element: 'SkinTypeRouting', current_flow: 'ProductResultsFlow', function_name: 'MyCloudFunction', error_reason: 'error message here' }
CLOUD_FUNCTION_LOG_INFO { current_element: 'SkinTypeRouting', current_flow: 'ProductResultsFlow', function_name: 'MyCloudFunction', message: '{api_response_code: 200}'}' }
CLOUD_FUNCTION_LOG_ERROR { current_element: 'SkinTypeRouting', current_flow: 'ProductResultsFlow', function_name: 'MyCloudFunction', message: 'server responded with 500, internal error' }
CLOUD_FUNCTION_START { current_element: 'SkinTypeRouting', current_flow: 'ProductResultsFlow', function_name: 'MyCloudFunction' }
QUICK_NAVIGATION_MESSAGE_SENT { current_element: 'IntroMessageThread', current_flow: 'WelcomeFlow' }
REFERRAL_PRESENTED { current_element: 'IntroMessageThread', current_flow: 'WelcomeFlow', referral_code: 'eDM' }
SLOT_VALIDATION_FAILED { current_element: 'userInputGroup_0', current_flow: 'EmailCaptureFlow', flow_name: 'EmailCaptureFlow', message_thread_name: 'EmailCapturePromopt', slot_name: 'EmailCapture', user_input_group_id: 1 }
SLOTS_CLEARED { current_element: 'ActionSequence', current_flow: 'RestartFlow', updated_slot: 'DOB' }
SLOTS_SET { current_element: 'userInputGroup_0', current_flow: 'EmailCaptureFlow', updated_slot: 'EmailCapture' }
USER_EVENT { user_event_payload:{ "eVar180":"I need ideas" }, current_flow:"Introduction", current_element:"Stage of Journey Slot Actions" }
USER_INPUT_GROUP_ENDED { current_element: 'userInputGroup_0', current_flow: 'EmailCaptureFlow', message_thread_name: 'EmailCapturePromopt', user_input_group_id: 1 }
USER_INPUT_GROUP_STARTED { current_element: 'userInputGroup_0', current_flow: 'SkinTypeFlow', message_thread_name: 'SkinTypePrompt', user_input_group_id: 1 }
KEYWORD_MATCHED { current_element: 'userInputGroup_0', current_flow: 'EmailCaptureFlow', keyword_matched_regex: finalRes.regex, keyword_matched_matching_substring: finalRes.matchingSubstring, keyword_nav_target: targetFlowStr, keyword_user_text: context.message.text }
NLP_RESPONSE_RECEIVED { raw_nlp_response: '...' }
INTENT_RESOLUTION { intent_name: "INTENT_NAME", intent_score: (Math.round(result.score * 100) / 100), user_query: "Take me to the buffet, please Janet" }
INTENT_NOT_RESOLVED { user_query: "Take me to the buffet, please Janet" }
ENTITY_RESOLUTION { entities_resolved: ["entity1", "entity2"] }
SENTIMENT_RESOLUTION { sentiment_resolved_text_score: "float between -1 and 1", sentiment_resolved_text_magnitude: "float between 0 and 1" }