Custom action is not working

Hi my endpoint URL is not hitting my external server.

actions.py

from rasa_core_sdk import Action from rasa_core_sdk.events import SlotSet

class ActionCheckRestaurants(Action): def name(self): # type: () -> Text return “utter_purpose”

def run(self, dispatcher, tracker, domain):

  return [dispatcher.utter_message("pankaj")]

endpoint

action_endpoint: url: “http://localhost:8080/smartoffice-web/app/chat/ins/data1

hey @pankaj can you write your dispatcher code outside the return iean just change the code to dispatcher.utter_message(“pankaj”) return [ ]

if the above code doesnt works try changing your endpoint.yml file to action_endpoint: url: “http://localhost:5055/webhook

yes i change the endpoint but still not working? here is my all details class ActionCheckRestaurants(Action): def name(self): return “utter_webcall”

def run(self, dispatcher, tracker, domain):
    r = requests.post('http://localhost:8080/smartoffice-web/app/chat/ins/data1', data={'key': 'value'})
    dispatcher.utter_message("john")


    return []

my domailn file

intents:

  • greet
  • goodbye
  • Name
  • employeeId
  • purpose
  • emaild

templates: utter_greet: - ‘Hi! Warm welcome to Itc infotech! Can i have your name please?’ utter_employeeId: - ’ Can i have your employeeId?’ utter_mailId: - ‘Can i also have your mail id please?’ utter_purpose: - ‘Purpose of visiting itc infotech?’ utter_goodbye: - ‘Talk to you later.’ - ‘Bye bye :(’

actions:

  • utter_greet
  • utter_employeeId
  • utter_mailId
  • utter_purpose
  • utter_webcall
  • utter_goodbye

story file

Generated Story 433797199515389101

  • greet
    • utter_greet
  • Name{“first_name”: “michael”}
    • utter_employeeId
  • employeeId
    • utter_mailId
  • eamaiId{“gmail”: "pankajkr2247@gmail.com"}
    • utter_webcall
  • purpose
    • utter_goodbye

can you tell me what error it throws?

it’s not giving any error simply not returning any response

1 Like

change the class name in your actions.py file to UtterWebcall and try…

Hey, maybe the emailid intent is not getting triggered. How are you defining it your nlu file?

Can you check with predefined entities provided by spacy? That way you’ll know if your action is getting triggered.

Does anyone know this problem? I am also struggling with that

Same issue with me a swell. Any luck on resolving this?