API calls from custom action

I want to call GET and POST webservices from my custom action how can i do that ? Any help would be really appreciated. I am using rasa core 0.12.4 and rasa nlu 0.13.8

Did you already took a look at our documentation about Actions? Apart from that you may want to look at our example restaurant bot (rasa/examples/restaurantbot at master · RasaHQ/rasa · GitHub). The restaurant bot does not call any other service in the end, but in the actions.py file it defines a RestaurantAPI class (rasa/actions.py at master · RasaHQ/rasa · GitHub), which could execute some API calls to other services. Does that help?

can i use Request module in python for doing REST calls ?

Yes, you can basically write any code you want in your custom actions.

ok thanks for the help :slightly_smiling_face:

The Git link doesn’t exist

1 Like

Hey were you able to successfully use requests library?

I am calling api in custom action, calling it using requests library raises " requests.exceptions.ConnectionError: (‘Connection aborted.’, RemoteDisconnected(‘Remote end closed connection without response’,))" inside the action server. but when calling the API outside the action server using the same code it responds properly!, any help?

I’m encountering the same trouble, did you get it fixed