Hello i made a small custom action
but when i try to get it and if my story has that custom action i am getting this error
rasa.core.actions.action - Failed to run custom action 'action_fetch_profile'. Couldn't connect to the server at 'http://localhost:5055/webhook'. Is the server running? Error: Cannot connect to host localhost:5055 ssl:default [No route to host]
2020-02-20 16:49:50 ERROR rasa.core.processor - Encountered an exception while running action 'action_fetch_profile'. Bot will continue, but the actions events are lost. Please check the logs of your action server for more information.
this is how my custom action looks
from typing import Any, Text, Dict, List
from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher
import requests
from rasa_sdk.actions import Action
from rasa_sdk.events import SlotSet
import xml.etree.ElementTree
def esb_api_call(payload,api_context):
url = f'''https://myapi/{api_context}'''
print(url)
result = requests.post(url=url,data=payload,headers={'Content-Type': 'application/json'})
return result
def accnum_by_mobile(mobile_number, count, last4digits):
#my logic here
return (count)
class FetchProfileAction(Action):
def name(self) -> Text:
return "action_fetch_profile"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
sender = tracker.sender_id
count = accnum_by_mobile(sender, True, "")
if(count == 0):
return [SlotSet("account_count", "no_acc")]
if(count == 1):
return [SlotSet("account_count", "sinlge_acc")]
if(count > 1):
return [SlotSet("account_count", "multi_acc")]
and this this my endpoints.yml file
action_endpoint:
url: "http://localhost:5055/webhook"
Looking at old error i tried changing the endpoints.yml file
after chnaging i got this error:
rasa.core.actions.action - Failed to run custom action 'action_fetch_profile'. Couldn't connect to the server at 'http://localhost:5055/webhook'. Is the server running? Error: Cannot connect to host localhost:5055 ssl:default [No route to host]
2020-02-20 16:49:50 ERROR rasa.core.processor - Encountered an exception while running action 'action_fetch_profile'. Bot will continue, but the actions events are lost. Please check the logs of your action server for more information.
can someone tell why i am getting that error and to fix.
i see my custom action is independent of endpoints.yml file, because i am doing the post request with in actions.py file