# Access previous message content from a user reply message on Telegram

**URL:** <https://forum.rasa.com/t/access-previous-message-content-from-a-user-reply-message-on-telegram/11089>\
**Category:** Rasa Open Source\
**Created:** [June 6, 2019, 2:53pm UTC](https://forum.rasa.com/t/access-previous-message-content-from-a-user-reply-message-on-telegram/11089 "2019-06-06T14:53:02Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![ErickGiffoni](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/erickgiffoni/32/3303_2.png) [@ErickGiffoni](https://forum.rasa.com/u/ErickGiffoni)\
**Post date:** [June 6, 2019, 2:53pm UTC](https://forum.rasa.com/t/access-previous-message-content-from-a-user-reply-message-on-telegram/11089/1 "2019-06-06T14:53:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ErickGiffoni](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/erickgiffoni/32/3303_2.png) [@ErickGiffoni](https://forum.rasa.com/u/ErickGiffoni)\
**Post date:** [June 6, 2019, 3:14pm UTC](https://forum.rasa.com/t/access-previous-message-content-from-a-user-reply-message-on-telegram/11089/2 "2019-06-06T15:14:54Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![JulianGerhard](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/juliangerhard/32/3781_2.png) [@JulianGerhard](https://forum.rasa.com/u/JulianGerhard)\
**Post date:** [June 6, 2019, 5:05pm UTC](https://forum.rasa.com/t/access-previous-message-content-from-a-user-reply-message-on-telegram/11089/3 "2019-06-06T17:05:08Z")

</div>

@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](https://rasa.com/docs/rasa/api/tracker/).

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

---

<div class="post-metadata">

**Author:** ![ErickGiffoni](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/erickgiffoni/32/3303_2.png) [@ErickGiffoni](https://forum.rasa.com/u/ErickGiffoni)\
**Post date:** [June 14, 2019, 2:59pm UTC](https://forum.rasa.com/t/access-previous-message-content-from-a-user-reply-message-on-telegram/11089/4 "2019-06-14T14:59:29Z")

</div>

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:

```auto
## 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.

---

<div class="post-metadata">

**Author:** ![JulianGerhard](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/juliangerhard/32/3781_2.png) [@JulianGerhard](https://forum.rasa.com/u/JulianGerhard)\
**Post date:** [June 14, 2019, 3:04pm UTC](https://forum.rasa.com/t/access-previous-message-content-from-a-user-reply-message-on-telegram/11089/5 "2019-06-14T15:04:28Z")

</div>

> [@ErickGiffoni](#):
>
> But when the user message is a reply message, how can I specify this dataset ? Can you understand now?

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?

---

<div class="post-metadata">

**Author:** ![ErickGiffoni](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/erickgiffoni/32/3303_2.png) [@ErickGiffoni](https://forum.rasa.com/u/ErickGiffoni)\
**Post date:** [June 14, 2019, 3:43pm UTC](https://forum.rasa.com/t/access-previous-message-content-from-a-user-reply-message-on-telegram/11089/6 "2019-06-14T15:43:45Z")

</div>

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

Let me try to clarify this a little more:

 ![53](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/3/3cd4f6e0c92b2c3cb4049831d605c8fb90f7a49a.png)

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…

---

<div class="post-metadata">

**Author:** ![JulianGerhard](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/juliangerhard/32/3781_2.png) [@JulianGerhard](https://forum.rasa.com/u/JulianGerhard)\
**Post date:** [June 15, 2019, 12:36pm UTC](https://forum.rasa.com/t/access-previous-message-content-from-a-user-reply-message-on-telegram/11089/7 "2019-06-15T12:36:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ErickGiffoni](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/erickgiffoni/32/3303_2.png) [@ErickGiffoni](https://forum.rasa.com/u/ErickGiffoni)\
**Post date:** [June 15, 2019, 5:45pm UTC](https://forum.rasa.com/t/access-previous-message-content-from-a-user-reply-message-on-telegram/11089/8 "2019-06-15T17:45:59Z")

</div>

YES !

---

<div class="post-metadata">

**Author:** ![JulianGerhard](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/juliangerhard/32/3781_2.png) [@JulianGerhard](https://forum.rasa.com/u/JulianGerhard)\
**Post date:** [June 17, 2019, 8:24pm UTC](https://forum.rasa.com/t/access-previous-message-content-from-a-user-reply-message-on-telegram/11089/9 "2019-06-17T20:24:16Z")

</div>

Hi,

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

RegardsÜ

---

<div class="post-metadata">

**Author:** ![ErickGiffoni](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/erickgiffoni/32/3303_2.png) [@ErickGiffoni](https://forum.rasa.com/u/ErickGiffoni)\
**Post date:** [June 18, 2019, 1:29pm UTC](https://forum.rasa.com/t/access-previous-message-content-from-a-user-reply-message-on-telegram/11089/10 "2019-06-18T13:29:57Z")

</div>

Ok, thanks. Have a great time.

---

<div class="post-metadata">

**Author:** ![JulianGerhard](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/juliangerhard/32/3781_2.png) [@JulianGerhard](https://forum.rasa.com/u/JulianGerhard)\
**Post date:** [June 23, 2019, 11:51am UTC](https://forum.rasa.com/t/access-previous-message-content-from-a-user-reply-message-on-telegram/11089/11 "2019-06-23T11:51:24Z")

</div>

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
