Training RASA core with Twilio: initialize slot based off of metadata

I have set up a Rasa bot integrated with Twilio. I have several slots that I would like to fill in the Rasa bot based on Twilio metadata (i.e. the user’s location, the time the message was sent, etc.) I have held off on training the bot, because I would like the stories to be dependent upon certain fields of the Twilio metadata.

For example, I would like Rasa to know whether or not the conversant has communicated to Rasa within the past 24 hours.

  1. How do I incorporate Twilio metadata for the purposes of training Rasa core?
  2. I would like to use Rasa interactive mode from the command line to train the bot. Is there any way to provide “placeholder” Twilio data to simulate actual metadata and have the bot learn likely stories (intent paths) this way?

More specifically, how would I pass in a value I get from the Twitter channel ( in rasa.core) immediately to a slot value? I want to pass in a few more values of the metadata and would like it to affect the slot filling. Any help would be greatly appreciated.

were you able to figure this out?


@souvikg10 Could you throw some light here

From the question above, i am not sure if i understood it well but you want to get metadata while training the bot or while a user is asking a question?

The metadata from Twilio is not categorical? because as you know there are different types of slots, if you have a categorical slot, you need to define the values upfront in the domain file before training the stories for such values.

Secondly, if it is to put values in the slot when a user asks the question from the twilio channel, you could pass such values programmatically using two ways

First way

  • placing an intent in domain file such as fill_location and slot name LOC
  • When you call the rasa core parse API, before calling the parse API with user text, call the API first with ‘/fill_location{“LOC”:“XYZ”}’ - this will set the slot and the intent will fill_location

A concrete example we had was for the welcome message. We had a WELCOME intent and a slot language. when the user opens the chat window for the first time, the front will call rasa core API will /WELCOME{“language”:“nl”}, this sets the slot language to nl, the action was to reply_welcome in nl. we train all the stories with WELCOME in front.

Second way First use the events API, of event type slot_set and set the value of the slot with the ones you need and then call the parse API. It could be even driven from events of the front end. Point of attention would be to ensure that the sequence of events are not broken otherwise it can impact the prediction action.