0

Is it possible to receive the previous message that the user have send to the chatbot (without using quick replies or postback buttons). Example:

User: "Can you call a friend?" Bot: "Who should I call?" User: "Tim"

In the API I now have just the information "Tim", without knowing if I should call him or text him or make him a sandwich or whatever. So I basically I want to add some Postbackdata or metadata additionally to the text "Can you call a friend" (intent: 'CALL'), so the message "Tim" will come with that data.

Is there a way without storing the data into a database? AWS Lambda with ClaudiaJs.

I found the metadata field in the FB API which turns out to be the wrong field for that since it is only for communicating between several apps?!

2 Answers2

0

What you are looking for a called a "slot-based bot", or slot-filling, basically meaning that you have a "slot", or blank that needs to be filled in before your bot can perform an action. In your example you have two slots: action and person Actions could be: call, text, message Person: name of a person, friend, etc.

I don't think any of the message frameworks (Slack, Facebook, etc) will provide you with the information you need. You will need to build this logic out yourself.

You can look at using wit.ai stories to achieve this.

Look to this similar Stack Overflow question and answer.

Community
  • 1
  • 1
Mikelax
  • 572
  • 3
  • 10
0

You can reverse order of conversation, and at beginning user writes some text or send you something else. After receiving, you should send to user buttonsTemplate, where postbacks will be like "CallTo&Tim" where instead of Tim you can put every text you need to pass to next executor(and you also can store previous user message here). Than just make substring of postback, check it`s type and do whatever you want.