# Get custom parameter in bot webhook and access it in the actions

**URL:** <https://forum.rasa.com/t/get-custom-parameter-in-bot-webhook-and-access-it-in-the-actions/38916>\
**Category:** Rasa Open Source\
**Created:** [January 12, 2021, 12:18pm UTC](https://forum.rasa.com/t/get-custom-parameter-in-bot-webhook-and-access-it-in-the-actions/38916 "2021-01-12T12:18:14Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![threxx](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/threxx/32/3620_2.png) [@threxx](https://forum.rasa.com/u/threxx)\
**Post date:** [January 12, 2021, 12:18pm UTC](https://forum.rasa.com/t/get-custom-parameter-in-bot-webhook-and-access-it-in-the-actions/38916/1 "2021-01-12T12:18:14Z")

</div>

Hello,

I want to pass a custom parameter, e.g.: “token” when a request is sent to my Rasa backend. This custom parameter I then want to access from a custom action. Is that somehow possible?

An example request:

```
{
  "sender": "sender1",
  "message": "How much money do I have on my bank account? ",
  "token": "123456"
}

```

Concerning the code in my actions.py, I am currently just trying out and using the example code from the [documentation](https://rasa.com/docs/action-server/sdk-actions).

Thanks!

---

<div class="post-metadata">

**Author:** ![Butusov](https://avatars.discourse-cdn.com/v4/letter/b/90db22/32.png) [@Butusov](https://forum.rasa.com/u/Butusov)\
**Post date:** [January 12, 2021, 7:01pm UTC](https://forum.rasa.com/t/get-custom-parameter-in-bot-webhook-and-access-it-in-the-actions/38916/2 "2021-01-12T19:01:38Z")

</div>

Hey @threxx. I think you should use the “metadata” object to transport custom data. Look here: [https://rasa.com/docs/rasa/connectors/custom-connectors](https://rasa.com/docs/rasa/connectors/custom-connectors)

---

<div class="post-metadata">

**Author:** ![threxx](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/threxx/32/3620_2.png) [@threxx](https://forum.rasa.com/u/threxx)\
**Post date:** [January 13, 2021, 12:19pm UTC](https://forum.rasa.com/t/get-custom-parameter-in-bot-webhook-and-access-it-in-the-actions/38916/3 "2021-01-13T12:19:59Z")

</div>

Hey, thanks for the input. As far as I understood I need to implement a custom connector then as well? Or is there a way to access the metadata in an action without it?

---

<div class="post-metadata">

**Author:** ![stephens](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/stephens/32/1632_2.png) [@stephens](https://forum.rasa.com/u/stephens)\
**Post date:** [January 14, 2021, 5:12am UTC](https://forum.rasa.com/t/get-custom-parameter-in-bot-webhook-and-access-it-in-the-actions/38916/4 "2021-01-14T05:12:55Z")

</div>

If you’re using the REST channel it supports the metadata object as shown in the link provided above by @Butusov

---

<div class="post-metadata">

**Author:** ![threxx](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/threxx/32/3620_2.png) [@threxx](https://forum.rasa.com/u/threxx)\
**Post date:** [January 14, 2021, 7:51am UTC](https://forum.rasa.com/t/get-custom-parameter-in-bot-webhook-and-access-it-in-the-actions/38916/5 "2021-01-14T07:51:06Z")

</div>

This somehow does not work for me. Let me show you my code, maybe I am doing something wrong:

my request body (GET request via postman `http://localhost:5005/webhooks/rest/webhook` ) is:

```
{
  "sender": "5db1ad69-b004-4aa4-a4bf-037abd7ba9af",
  "message": "List all my courses",
  "metadata": {
      "token": "some extra information"
  }
}

```

And in the **action.py** I just do `print(tracker.latest_message)`:

```
from typing import Text, Dict, Any, List
from rasa_sdk import Action, Tracker
from rasa_sdk.events import SlotSet
from rasa_sdk.executor import CollectingDispatcher

class ActionCheckRestaurants(Action):
	def name(self) -> Text:
		return "action_get_courses"

	def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
		print(tracker.latest_message)
		dispatcher.utter_message(text = "Hello")
		return []

```

with the following result:

`{'intent': {'id': -3970330514659824069, 'name': 'get_courses', 'confidence': 0.9978423714637756}, 'entities': [], 'text': 'List all my courses', 'message_id': 'ded8a95b1c0f4230932d2f8a35279f26', 'metadata': {}, 'intent_ranking': [{'id': -3970330514659824069, 'name': 'get_courses', 'confidence': 0.9978423714637756}, {'id': 9073406446022162066, 'name': 'out_of_scope', 'confidence': 0.0020098222885280848}, {'id': -5089103512759352920, 'name': 'thank', 'confidence': 8.310468547279015e-05}, {'id': 2222171025580606878, 'name': 'affirm', 'confidence': 3.207153713447042e-05}, {'id': 1515188917182966015, 'name': 'faq', 'confidence': 1.7392963854945265e-05}, {'id': 5517892651944656367, 'name': 'goodbye', 'confidence': 1.4894237210683059e-05}, {'id': 3016223801878893438, 'name': 'greet', 'confidence': 2.8274325813981704e-07}, {'id': 1952904714508125642, 'name': 'deny', 'confidence': 7.317380124050032e-08}], 'response_selector': {'all_retrieval_intents': ....`

So **metadata** seems to be an empty object. Am I missing something?

---

<div class="post-metadata">

**Author:** ![stephens](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/stephens/32/1632_2.png) [@stephens](https://forum.rasa.com/u/stephens)\
**Post date:** [January 14, 2021, 4:11pm UTC](https://forum.rasa.com/t/get-custom-parameter-in-bot-webhook-and-access-it-in-the-actions/38916/6 "2021-01-14T16:11:48Z")

</div>

No, I also tried it and it didn’t work for me. I think the code example I sent you to is no longer working in 2.x.

Instead of using the earlier link I provided, you should base your code on the [latest source](https://github.com/RasaHQ/rasa/blob/395f768d91d3fc8a63f68fb4e4c3dd159b0904d6/rasa/core/actions/action.py#L475) for `action_session_start`.

---

<div class="post-metadata">

**Author:** ![threxx](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/threxx/32/3620_2.png) [@threxx](https://forum.rasa.com/u/threxx)\
**Post date:** [January 14, 2021, 6:24pm UTC](https://forum.rasa.com/t/get-custom-parameter-in-bot-webhook-and-access-it-in-the-actions/38916/7 "2021-01-14T18:24:36Z")

</div>

Thanks for pointing me there. As I am quite new to Rasa, does that mean that I need to implement `action_session_start` in my action.py as well?

---

<div class="post-metadata">

**Author:** ![stephens](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/stephens/32/1632_2.png) [@stephens](https://forum.rasa.com/u/stephens)\
**Post date:** [January 15, 2021, 5:08am UTC](https://forum.rasa.com/t/get-custom-parameter-in-bot-webhook-and-access-it-in-the-actions/38916/8 "2021-01-15T05:08:51Z")

</div>

Looks like this issue has already been reported [here](https://github.com/RasaHQ/rasa/issues/7420). Please follow progress for a fix there.

---

<div class="post-metadata">

**Author:** ![threxx](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/threxx/32/3620_2.png) [@threxx](https://forum.rasa.com/u/threxx)\
**Post date:** [January 15, 2021, 12:36pm UTC](https://forum.rasa.com/t/get-custom-parameter-in-bot-webhook-and-access-it-in-the-actions/38916/9 "2021-01-15T12:36:46Z")

</div>

So I updated `processor.py` in core as you have shown in the other issue. However, I again couldn’t find `metadata` anywhere. I thought to find them in the slots or in the `latest_message`. But the `slots` do not have anything stored and `metadata` in `latest_message` is still an empty object. Where should it be stored? How can I access it in my custom action?

---

<div class="post-metadata">

**Author:** ![kgk](https://avatars.discourse-cdn.com/v4/letter/k/edb3f5/32.png) [@kgk](https://forum.rasa.com/u/kgk)\
**Post date:** [March 6, 2023, 10:14pm UTC](https://forum.rasa.com/t/get-custom-parameter-in-bot-webhook-and-access-it-in-the-actions/38916/10 "2023-03-06T22:14:04Z")

</div>

Hello! Did you manage to resolve this? I am struggling with a similar issue myself. Thanks!
