Access previous message content from a user reply message on Telegram

Hi,

Does anyone know how can I access a previous message content when a user sends a reply message on Telegram?

After that, how can I make rasa understand this reply message as an intent ?

I appreciate any help.

Here is an explanation: Let’s prettend this is a Telegram chat. I just did a reply to my own post. Now, I want to access the post’s content, which is my previous message content. How can I do that ? I think this has something to do with the “tracker”… Furthermore, how can I make rasa understand this reply message as an intent ?

@ErickGiffoni

Hi,

I think you are refering to is indeed the tracker. You can access the latest message by:

tracker = DialogueStateTracker.from_dict(sender_id, events, domain.slots) 
latest_message = tracker.latest_message

Keep in mind that you maybe want “latest_message.text” for a string. Further information ca be found here.

Can you please give more details for your follow up question: “Furthermore, how can I make rasa understand this reply message as an intent” ?

Regards

1 Like

Thanks, my friend. @JulianGerhard

So, about this question : “ Furthermore, how can I make rasa understand this reply message as an intent ” … When we create intents on the domain file, we specify its dataset on a .md file. For example: if we had a good_morning intent, we would specify it like this:

## intent:good_morning
- hey, good morning
- good morning
- morning

and so on…

But when the user message is a reply message, how can I specify this dataset ? Can you understand now?

Sorry I took long to answer you.

You mean:

How should the training data look like to classify the intent that hopefully lies in the reply of the user like in the following story:

* good_morning
 - utter_good_morning
* want_to_know_bots_name
 - utter_bots_name

You simply need to define another intent and embedd it in your story. Rasa checks and predicts the next action for you and during this, it classifies the reply and for that it relies on the training data.

Does that answer your question?

Unfortunately not… it’s more complicated than that… but thanks.

Let me try to clarify this a little more:

That’s a reply message. I want to know how can I make Rasa understand this reply as an intent… not by the message itself, but by the the action of doing a reply.

Is it clear now? If not let me know…

You mean that the intent actually is that the user replied and not what he replied?

1 Like

YES !

Hi,

I am on vacation until wednesday. If not already obsolet, I will take a look upon after returning!

RegardsĂś

1 Like

Ok, thanks. Have a great time.

Hi @ErickGiffoni

back to business. Is the case still up-to-date?

If so, can you give me an idea what you want to to based on the assumption that we are able to identify the intent “user_answered” ? I need to know this because it enables me to think about a possible solution? So - what should happen then?

Regards