I installed the rasa-demo code sample. For turning on the rasa actions I did:
user@User:~/rasa-demo ‹master*›$ rasa run actions --actions actions
2020-06-15 21:35:49 INFO rasa_sdk.endpoint - Starting action endpoint server...
2020-06-15 21:35:50 INFO rasa_sdk.executor - Registered function for 'action_explain_sales_form'.
2020-06-15 21:35:50 INFO rasa_sdk.executor - Registered function for 'action_explain_faq'.
2020-06-15 21:35:50 INFO rasa_sdk.executor - Registered function for 'action_set_faq_slot'.
2020-06-15 21:35:50 INFO rasa_sdk.executor - Registered function for 'action_pause'.
2020-06-15 21:35:50 INFO rasa_sdk.executor - Registered function for 'action_store_unknown_product'.
2020-06-15 21:35:50 INFO rasa_sdk.executor - Registered function for 'action_store_unknown_nlu_part'.
2020-06-15 21:35:50 INFO rasa_sdk.executor - Registered function for 'action_store_bot_language'.
2020-06-15 21:35:50 INFO rasa_sdk.executor - Registered function for 'action_store_entity_extractor'.
2020-06-15 21:35:50 INFO rasa_sdk.executor - Registered function for 'action_set_onboarding'.
2020-06-15 21:35:50 INFO rasa_sdk.executor - Registered function for 'action_store_problem_description'.
2020-06-15 21:35:50 INFO rasa_sdk.executor - Registered function for 'action_greet_user'.
2020-06-15 21:35:50 INFO rasa_sdk.executor - Registered function for 'action_default_ask_affirmation'.
2020-06-15 21:35:50 INFO rasa_sdk.executor - Registered function for 'action_default_fallback'.
2020-06-15 21:37:06 INFO rasa_sdk.executor - Registered function for 'action_get_community_events'.
2020-06-15 21:37:06 INFO rasa_sdk.executor - Registered function for 'action_next_step'.
2020-06-15 21:37:06 INFO rasa_sdk.executor - Registered function for 'action_docs_search'.
2020-06-15 21:37:06 INFO rasa_sdk.executor - Registered function for 'action_forum_search'.
2020-06-15 21:37:06 INFO rasa_sdk.executor - Registered function for 'action_tag_feedback'.
2020-06-15 21:37:06 INFO rasa_sdk.executor - Registered function for 'action_tag_docs_search'.
2020-06-15 21:37:06 INFO rasa_sdk.executor - Registered function for 'subscribe_newsletter_form'.
2020-06-15 21:37:06 INFO rasa_sdk.executor - Registered function for 'sales_form'.
2020-06-15 21:37:06 INFO rasa_sdk.executor - Registered function for 'suggestion_form'.
Then in the same folder, I can test with the rasa shell as follows:
user@User:~/rasa-demo ‹master*›$ rasa shell
2020-06-15 21:47:44 INFO root - Starting Rasa server on http://localhost:5005
2020-06-15 21:47:50 INFO absl - Using /var/folders/h5/9rj1zn8x4s59bk_mg_ktzv740000gn/T/tfhub_modules to cache modules.
2020-06-15 21:48:20 INFO root - Rasa server is up and running.
Bot loaded. Type a message and press enter (use '/stop' to exit):
Your input -> hi
Hey there, my name is Sara.
By chatting to me you agree to our [privacy policy](https://rasa.com/privacy-policy/).
If you're new to Rasa, I can help you get started! If you've already started building an assistant, you can also ask me about the different parts of Rasa 🐦
How can I query as an API the chatbot? That is, instead of using the shell, I would like be aple to make a request and do the conversation through requests. So far I tried making a curl to the rasa server:
user@User:~/rasa-demo ‹master*›$ curl --request POST \
--url http://localhost:5005/webhooks/rest/webhook \
--header 'content-type: application/json' \
--data '{
"message": "Hello"
}'
UPDATE
I also tried this:
In:
import requests
response = requests.get('http://localhost:5005/webhooks/rest/webhook')
print(response)
print(response.headers)
print(response.content)
Out:
<Response [405]>
{'Connection': 'keep-alive', 'Keep-Alive': '5', 'Allow': 'POST', 'Access-Control-Allow-Credentials': 'true', 'Content-Length': '60', 'Content-Type': 'text/plain; charset=utf-8'}
b'Error: Method GET not allowed for URL /webhooks/rest/webhook'
However, it is not working. What is the correct way to request Rasa as an API?