Hi all,
I am trying to use a custom action to interact with an external API.
For example, let’s imagine I have a password intent that triggers a custom action called action_2FA. action_2FA wants to authenticate an external service and sends an email to the user asking for a verification code. I want the user to be able to provide the verification code and be authenticated before the custom action ends.
More explicitly,
User: I want access to authenticated service.
– custom action gets triggered, calling API
Bot (from API): Please enter the password.
User: ABCDEFG
Bot (from API): Please enter the code on your mobile device.
User: 1234567
Bot (from API): Authenticated.
–custom action ends
Note: This example is purely illustrative and we have no intention of performing user authentication in this fashion. We just use this example to illustrate the API requiring a few back and forths.
So far, I tried to use just use a while(True) loop in my custom action to experiment, but the rasa_server threw an exception TimeoutError, and the bot essentially crashed.
I’m unsure if followup actions would be useful in this case, but I’d like to essentially design the following
running = True
while running:
//interact with API
if API returns done:
running = False
end custom action