# Accessing metadata in preprocessing

**URL:** <https://forum.rasa.com/t/accessing-metadata-in-preprocessing/41711>\
**Category:** Rasa Open Source\
**Created:** [March 25, 2021, 1:57pm UTC](https://forum.rasa.com/t/accessing-metadata-in-preprocessing/41711 "2021-03-25T13:57:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hannah94](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/hannah94/32/12543_2.png) [@hannah94](https://forum.rasa.com/u/hannah94)\
**Post date:** [March 25, 2021, 1:57pm UTC](https://forum.rasa.com/t/accessing-metadata-in-preprocessing/41711/1 "2021-03-25T13:57:10Z")

</div>

Is it possible to access custom metadata in the pre-processing/ custom component section?

I have a custom component that I need to add context to from the metadata , say for example I have a field in the metadata called “name\_or\_not” : True/False and I know this field is being passed through from my custom connector to my action server, so it’s definitely working. Now I want to preprocess the message differently depending on if the item is True or False.

I’m going on the assumption that it’s not possible based on this article

> [@Passing extra parameters to the Http API to parse a message](http://forum.rasa.com/t/passing-extra-parameters-to-the-http-api-to-parse-a-message/21011):
>
> We have a requirement to employ a “context-sensitive” NLU. That is, an NLU that is aware of where it is within a conversation. We are only using the NLU portion of Rasa and cannot use core currently. With that in mind I see that the format for /model/parse only has a text and id field. I decided I can solve this by passing the context information in a specific format and pull out the data in the pipeline by doing preprocessing. For example the text of the message would appear like this: “This …

But I would appreciate the help! Thanks

---

<div class="post-metadata">

**Author:** ![hannah94](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/hannah94/32/12543_2.png) [@hannah94](https://forum.rasa.com/u/hannah94)\
**Post date:** [March 25, 2021, 2:11pm UTC](https://forum.rasa.com/t/accessing-metadata-in-preprocessing/41711/2 "2021-03-25T14:11:17Z")

</div>

It would also be acceptable to have access to the tracker and receive the last question asked from there, so if Rasa bot asks “What is your name?” I can follow the logic as if the metadata said True. But I’m hoping to have either metadata or tracker events here.

EDIT: never mind I would need the sender ID to access the tracker store which is stored as metadata.

---

<div class="post-metadata">

**Author:** ![hannah94](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/hannah94/32/12543_2.png) [@hannah94](https://forum.rasa.com/u/hannah94)\
**Post date:** [March 25, 2021, 2:40pm UTC](https://forum.rasa.com/t/accessing-metadata-in-preprocessing/41711/3 "2021-03-25T14:40:45Z")

</div>

Maybe I can overwrite the Message class so that when the Component receives the Message it has an attribute message.metadata , is that possible?

> <https://github.com/RasaHQ/rasa/blob/74ce55924e820be3cd81fcc105ed4ba6b7225df4/rasa/shared/nlu/training_data/message.py#L30>
