Hi i across googling the solution to pass the data from the js rasa webchat to the custom action. Some of the solution using the steps :
- add this code to the credential.yml
socketChannel.SocketIOInput: user_message_evt: user_uttered bot_message_evt: bot_uttered session_persistence: false
- copy paste socketChannel.py (i don’t know where to put, so i put this to the root project folder/same location with credential.yml) socketChannel.py (6.9 KB) I already add this to the socketChannel.py :
message = UserMessage( data[“message”], output_channel, sender_id, input_channel=self.name(),metadata=data[“customData”] )
- this is my index.html codeindex.html (1.3 KB)
my custom data file code
customData: [{“language”: “en”, “sender_email":"freddy.yonata@gmail.com”}]
i want to pass “sender_email” but when i have stories like
- story: init-webchat steps:
- intent: greetWebchat
- action: action_hello_world
in the action_hello_world i try to get metadata using this function
def extract_metadata_from_tracker(tracker): events = tracker.current_state()[‘events’] user_events = for e in events: if e[‘event’] == ‘user’: user_events.append(e)
return user_events[-1]['metadata']
but it is return the metadata by blank
could someone help me?
i already try to pass the sender_email in initPayload like initPayload : ‘/greetWebchat{“sender_email”:“freddy@mail.com”}’ this give me error in terminal as internal server eerror