Skip to content

Latest commit

History

History
54 lines (48 loc) 路 1.37 KB

custom-actions.mdx

File metadata and controls

54 lines (48 loc) 路 1.37 KB
id sidebar_label title abstract
custom-actions
Custom Actions
Custom Actions
A custom action can run any code you want, including API calls, database queries etc. They can turn on the lights, add an event to a calendar, check a user's bank balance, or anything else you can imagine.

For details on how to implement a custom action, see the SDK documentation. Any custom action that you want to use in your stories should be added into the actions section of your domain.

When the dialogue engine predicts a custom action to be executed, it will call the action server, with the following information:

{
  "next_action": "string",
  "sender_id": "string",
  "tracker": {
    "conversation_id": "default",
    "slots": {},
    "latest_message": {},
    "latest_event_time": 1537645578.314389,
    "followup_action": "string",
    "paused": false,
    "events": [],
    "latest_input_channel": "rest",
    "active_loop": {},
    "latest_action": {},
  },
"domain": {
    "config": {},
    "session_config": {},
    "intents": [],
    "entities": [],
    "slots": {},
    "responses": {},
    "actions": [],
    "forms": {},
    "e2e_actions": []
  },
  "version": "version"
}

Your action server should respond with a list of events and responses:

{
  "events": [{}],
  "responses": [{}]
}