hi
i am sending userid in custom data using rasa webchat and i want to get this id for each session & store in slots so that i can perform queries from database or api for that user.
Please help me with this…i am new to rasa
Thanks in advance
hi
i am sending userid in custom data using rasa webchat and i want to get this id for each session & store in slots so that i can perform queries from database or api for that user.
Please help me with this…i am new to rasa
Thanks in advance
Hi @priya359 , Did you get the solution??
hey @Aashay1 for now, i am doing it by setting slots in initpayload of rasa webchat
Hi @priya359 , can you share your code to fetch data from initpaylod ,
i was able to get the data , but for some reason its not working now .
Thank you
hi
initPayload: “/get_started{“empCode”:“421”, “empName”:“Priya”}”
here, empCode and empName are slots and it got set with get_started intent & then you can access your slots from tracker in actions.py for custom action or api call
I hope, it will help you
The actions.py code , i am not able to fill the slot , I guess I am missing something !!!
you need to start conversation with get_started intent so that slot can set,
write a short story in stories.md like
Hi @priya359,
can I have our git repo , I am not able to follow-up
Hello, how are you? I can’t get me to take a variable, will you know how to do it? I tried as follows and it did not work for me
var tram1 = “process 1”;
var tram2 = “’” +’ / tramiteIniciado {“tramite”: “’+ tram1 +’”} ‘+ "’";
WebChat.default.init ({
selector: "#webchat",
tram2,
customData: {"language": "is"},
socketUrl: "http://172.16.64.253:5005",
customData: {"userId": "123"},
socketPath: "/socket.io/",
title: "Mendoza Tax Administration",
subtitle: "Virtual Assistant",
})
Enviar comentarios Historial Guardadas
How did you send the customData back to the API?
You can access the custom data by adding this file to your project :
socketChannel.py (6.8 KB) and add metadata
to UserMessage in handle_message function
as :
message = UserMessage(
data["message"], output_channel, sender_id, input_channel=self.name(),
metadata = data['customData']
)
Update your crendentials file to:
socketChannel.SocketIOInput:
user_message_evt: user_uttered
bot_message_evt: bot_uttered
session_persistence: true
Finally you can get your custom data from custom action as below:
events = tracker.current_state()['events']
user_events = []
for e in events:
if e['event'] == 'user':
user_events.append(e)
custom_data = user_events[-1]['metadata']