Actions

Actions allow you to actually do things when you need to.

Action categories

An action can either be:

  • A message to send back to the user
  • An HTTP call to your API
  • The redirection and execution of another skill
  • Reset the memory of the current conversation

Recast.AI - Action

Message actions

For message actions, all rich messaging formats formats are supported.

See more about rich messaging

Recast.AI - Messages types

Formatting: You can inject variables in your messages by using the double braces syntax. For example, {{nlp.source}} will be replaced by the input sentence.

Here is a list of the more useful ones:

  • {{nlp.source}}: raw user input.
  • {{nlp.entities.location[0]}}: first entity detected of the type location. You can replace location by any entity name you want.
  • {{#location.raw}}: same as above, get the first entity location detected, and get its raw field.
  • {{nlp.sentiment}}: sentiment of the sentence
  • {{nlp.act}}: act of the sentence
  • {{nlp.type}}: type of the sentence
  • {{nlp.intents[0].slug}}: slug of the first intent detected
  • {{memory.person.raw}}: a value stored in the memory of the bot. Here person is the alias of a requirement
  • {{skill}}: slug of the current skill
  • {{skill_occurrences}}: number of consecutive occurrences of the current skill

Recast.AI - Action

Webhook

For webhooks (HTTP actions) you can provide either a full url, or simply a route that will be added to your bot's base url (updatable in your bot settings).

When your url we be called you will receive the complete state of the conversation:

{
 "messages": [],
 "conversation": {
   "id": "A_CONVERSATION_ID",
   "language": "en",
   "memory": {
     "person": {
       "fullname": "Francois",
       "raw": "Francois",
       "confidence": 0.95
     }
   },
   "skill": "small-talk",
   "skill_occurences": 1
 },
 "nlp": {
   "source": "hi",
   "intents": [
     {
       "slug": "greetings",
       "confidence": 0.99
     }
   ],
   "sentiment": "vpositive",
   "entities": {},
   "act": "assert",
   "type": null,
   "version": "2.10.1",
   "processing_language": "en",
   "language": "en",
   "uuid": "96597974-3ee1-4743-8a5d-341b67effb9a"
   "status": 200,
   "timestamp": "2017-10-25T21:36:02.071243+00:00",
 }
}

And you will be able to send back the message you want to send to the user, as well as update the conversation state if you need.

See more about messages format