Rasa Core version :
0.12.3
Python version :
3.6.7
Operating system (windows, osx, …):
Ubuntu 18.04
Issue :
Hi guys! So I have created a bot for my web app and uploaded it on AWS so that my web app can send a GET request and get the response from the rasa_core. But for a specific user i need to pass an id in the GET request. like :
So i want to track this 27 in my action file so that i can make an api call using this id as a parameter.
OR
IF you can suggest a way that I can get the user_id in the start of conversation when my user opens the bot widget. I tried to set as user_id = tracker.get_slot(‘recipient_id’) but this doesn’t work!
Any help is appreciated. I’m stuck on this issue for 2 days!
The important part hereby is --credentials credentials.yml. credentials.yml should have this content for REST
rest:
# no config needed
You can the send message to the REST channel by doing a POST request to /webhooks/rest/webhook with the content (e.g. localhost:5005/webhooks/rest/webhook)
hey@ ashukrishna It’s not working for me! I ran the REST server then in my custom action I added this.
class ActionOnline(Action):
def name(self):
return ‘action_online’
def run(self, dispatcher, tracker, domain):
online = tracker.get_slot('online')
#tracker for user_id
user_id = (tracker.current_state())["sender_id"]
dispatcher.utter_message(user_id)
parameters = {}
for i in ('user_id'):
parameters[i] = locals()[i]
data = requests.post("my_api_id",params= parameters)
response = data.json()
onlineuser= response["onlineUserList"][0]["user_name"]#change
answer = """These users are currently online {} .""".format(onlineuser)
dispatcher.utter_message(answer)
return [SlotSet('online',online)]
I tried to dispatch the user_id by utter_message but I’m getting Keyerror bcoz user_id is empty in loop. So user_id is not allocating. can you check this action
hi @Akshit I encountered a similar issue as you, but my version is 0.11.12
As the doc HTTP API GET, the link is http://localhost:5005/conversations/default/tracker
Now I want to get the log of each user’s data, I guess I need to replace default to user_id ?
I tried your method, but the bot just stopped reply and crashed.
You are getting the user_id as default from the print(user_id) command right?
Try printing the tracker info and comment the next lines. Make sure you are getting the data from tracker.
DEBUG:rasa_core_sdk.executor:Received request to run 'action_agree'
DEBUG:actions:-------slot_agree---------
DEBUG:actions:123456789
DEBUG:actions:-------slot_agree---------
c06c5089-5b3e-4ceb-a114-fe4536188b27
Oh I thought you would have done that already! That’s why I was telling you to check if a response is coming or not. Do you use postman? You can run the api call and get the tracker data. It’s good for a clearer answer!
Yes I’m doing something similar! We have 10 client right now who has access to our demo bot and we are saving the tracker details and storing all in our db!
I don’t see anything wrong! Maybe someone with coding background can help you! POSTMAN Is just for using api calls and getting the response. it’s helpful if you want to see the tracker data in a more clearer way! check this out
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>404 Not Found</title>
<h1>Not Found</h1>
<p>The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.</p>