My testing attempts:
I have very simply action: grab last message and post it back to the user:
class Test(Action):
def name(self):
return 'action_test'
def run(self, dispatcher, tracker, domain):
last_message = tracker.latest_message.get("text", "")
dispatcher.utter_message('Echo:')
dispatcher.utter_message(last_message)
return []
What i’ve tried:
-
Append a reminder event to the tracker.
POST http://localhost:5005/conversations/{conversation_id}/tracker/events
{
"event": "reminder",
"action": "action_test",
"date_time": "2019-05-29T02:50:10.128172",
"name": "my_reminder",
"kill_on_user_msg": true.
}
What I see in the logs (with --debug --verbose keys):
rasa_1 | 2019-05-29 02:41:09 DEBUG rasa.core.tracker_store - Recreating tracker for id '{conversation_id}'
rasa_1 | 2019-05-29 02:44:23 DEBUG rasa.core.tracker_store - Recreating tracker for id '{conversation_id}'
rasa_1 | 2019-05-29 02:45:43 DEBUG rasa.core.tracker_store - Recreating tracker for id '{conversation_id}'
rasa_1 | 2019-05-29 02:45:54 DEBUG rasa.core.tracker_store - Recreating tracker for id '{conversation_id}'
rasa_1 | 2019-05-29 03:03:19 DEBUG rasa.core.tracker_store - Recreating tracker for id '{conversation_id}'
Nothing happens at shedulled time, even no errors in logs.
- Execute an action via http api
As description says “Any responses sent by the executed action will be returned as part of the endpoints result, they will not be sent over a connected output channel.” - user not recieved responce from action.
-
Post the message to the REST channel:
POST http://localhost:5005/webhooks/rest/webhook
{
"sender": "{conversation_id}",
"message": "action_test"
}
In such way, reply was sent back to the rest channel, not via connected output channel.
As I see in the logs, my conversation_id = user_id in connected output channel:
rasa_1 | 2019-05-30 02:28:36 DEBUG rasa.core.agent - Created a new lock for conversation '{conversation_id}'
rasa_1 | 2019-05-30 02:28:36 DEBUG rasa.core.tracker_store - Recreating tracker for id '{conversation_id}'
-
Post the message to the connected output channel with user_id
POST http://localhost:5005/webhooks/telegram/webhook
{
"update_id": {event id},
"message": {
"message_id": {message id},
"from": {
"id": {conversation_id},
"is_bot": false,
"first_name": "",
"username": "",
"language_code": "ru"
},
"chat": {
"id": {conversation_id},
"first_name": "",
"username": "",
"type": "private"
},
"date": {unix time stamp},
"text": "action_test"
}
}
With this method, user receives message, but I’am not sure, what it is the right way, to implement notification function (i should specify messanger related attributes in the request, like update_id
, message_id
, user first_name
, username
… and so on).
So main question, how can I call Rasa action from other system on my side, to notify my users via connected output channel?
Use cases: birthday reminder, notification from monitoring system, notification about ticket resolution etc.