Dear Team, I have created a bot using RASA 3.7.1 and it good active. When I open chat frame with my code (not Botfront), I want chatbot show the message “Hello !” but it can’t. On forum have this question but with Rasa 2.x so it isn’t help me. Help me, please! Thank you so much!
My code: 1> In domain.yml file, I register action_greet 2> In stories.yml file: - story: hello path steps: - intent: greet - action: action_greet 3> In scripts.js file: customActionTrigger(); 4> In constants.js file: const action_name = “action_greet”; const rasa_server_url = “http://localhost:5005/webhooks/rest/webhook”; const sender_id = uuidv4(); 5> In actions.py file: class Hello(Action): def name(self): return “action_greet”
def run(self, dispatcher, tracker, domain):
dispatcher.utter_message("Hello!")
return []
6> In chat.js file: function customActionTrigger() { $.ajax({ url: “http://localhost:5055/webhook/”, type: “POST”, contentType: “application/json”, data: JSON.stringify({ next_action: action_name, tracker: { sender_id, }, }), success(botResponse, status) { console.log("Response from Rasa: ", botResponse, "\nStatus: ", status);
if (Object.hasOwnProperty.call(botResponse, "responses")) {
setBotResponse(botResponse.responses);
}
$("#userInput").prop("disabled", false);
},
error(xhr, textStatus) {
// if there is no response from rasa server
setBotResponse("");
console.log("Error from bot end: ", textStatus);
$("#userInput").prop("disabled", false);
},
});
}