# Using agent.parse\_message with UserMessage object

**URL:** <https://forum.rasa.com/t/using-agent-parse-message-with-usermessage-object/51332>\
**Category:** Rasa Open Source\
**Created:** [February 14, 2022, 2:52pm UTC](https://forum.rasa.com/t/using-agent-parse-message-with-usermessage-object/51332 "2022-02-14T14:52:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dvirco](https://avatars.discourse-cdn.com/v4/letter/d/7feea3/32.png) [@dvirco](https://forum.rasa.com/u/dvirco)\
**Post date:** [February 14, 2022, 2:52pm UTC](https://forum.rasa.com/t/using-agent-parse-message-with-usermessage-object/51332/1 "2022-02-14T14:52:33Z")

</div>

Hey, I have a Python code that uses agent.parse\_message on python strings and it works perfectly. Now I want to add metadata as additional input (I have a custom compenent that support it), but I can’t seems to make it work. It looks like parse\_message only accept string as input (and not UserMessage), and while there is a similar function that can work with as input, agent.handle\_message, it returns None.

How can I include the metadata that I need and get the predicted intents and entities?

Code example:

```auto
    user_message = UserMessage(
        'How do i sign up?',
        metadata={'context': 'stores'},
    )
    result = asyncio.run(agent.handle_message(user_message))
    print(json_to_string(result)) # returns None

    result = asyncio.run(agent.parse_message(user_message)) # throw AttributeError for not being string
    print(json_to_string(result))

    result = asyncio.run(agent.parse_message('How do i sign up?')) # Works, but without the metadata
    print(json_to_string(result))

```

---

<div class="post-metadata">

**Author:** ![dvirco](https://avatars.discourse-cdn.com/v4/letter/d/7feea3/32.png) [@dvirco](https://forum.rasa.com/u/dvirco)\
**Post date:** [February 27, 2022, 9:39am UTC](https://forum.rasa.com/t/using-agent-parse-message-with-usermessage-object/51332/2 "2022-02-27T09:39:52Z")

</div>

Hey, Is there no way to use metadata in rasa 3.0?
