Skip to toolbar
laptop, computer, business

RASA Form Actions: Calling SatukanCinta API

Hi there! This post is the continuation of the blog post before.

In this post, I’ll be giving a tutorial in getting the information if user has registered an account in SatukanCinta.

So the information needed to check if the user has registered an account is full name, email, and also phone number.
Here we are using form actions to call the API and also help validate if the input (full name, email, phone number) is in the right format and exists.

So what you have to do first is create the NLU, and the intents. (I have explained it in the previous blog post about how to create it).

The next thing you have to do is to create the python project to call API outside of RASA.
This is my python project to call SatukanCinta API (The token value is credential so it’s censored).

Python Project to Call SatukanCinta API

The next thing you have to do is to create the form action class in the actions.yml file.
I created the form action class, here is a sneak peek of the action form class I created.

Form Action to Call API and Validate Slots Value

The form action will require 3 slots (email, name, phone number), and it will check on the API with all this requirements:
– if the email is registered
– if the user’s full name being input is the same as the user’s registered account (between Levenshtein distance)
– if the user’s phone number input is the same as the user’s registered phone number

If it doesn’t matches one of this requirements, then the bot will ask the user to reinput the information needed.

For more explanation about form actions to call API, you can checkout this video:

Thank you!:)

Leave a Comment

Your email address will not be published. Required fields are marked *