# Pass the value explicitly when calling the template

**URL:** <https://forum.rasa.com/t/pass-the-value-explicitly-when-calling-the-template/21117>\
**Category:** Rasa Open Source\
**Created:** [November 12, 2019, 6:00am UTC](https://forum.rasa.com/t/pass-the-value-explicitly-when-calling-the-template/21117 "2019-11-12T06:00:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vinoth](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/vinoth/32/5894_2.png) [@vinoth](https://forum.rasa.com/u/vinoth)\
**Post date:** [November 12, 2019, 6:00am UTC](https://forum.rasa.com/t/pass-the-value-explicitly-when-calling-the-template/21117/1 "2019-11-12T06:00:00Z")

</div>

Hi,

I am trying to pass a value from custom action to a template’s variable. I got an error as " Failed to fill utterance template ‘value from custom action is {my\_variable}’. Tried to replace ‘my\_variable’ but could not find a value for it. There is no slot with this name nor did you pass the value explicitly when calling the template. Return template without filling the template."

action.py

class ActionCustom(Action):

```
  def name(self):

    return "utter_template"

  def run(self, dispatcher, tracker, domain):

  # send utter default template to user
      dispatcher.utter_template("utter_template", tracker, my_variable="hello world")
  # ... other code
     return []

```

NLU

## intent:template

- template
- temp

stories

## template

- template
  - utter\_template

and my domain

intents:

- greet
- template

templates: utter\_template:

- text: value from custom action is {my\_variable}

actions:

- utter\_template

---

<div class="post-metadata">

**Author:** ![MaxGdr](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/maxgdr/32/10748_2.png) [@MaxGdr](https://forum.rasa.com/u/MaxGdr)\
**Post date:** [November 29, 2019, 2:48pm UTC](https://forum.rasa.com/t/pass-the-value-explicitly-when-calling-the-template/21117/2 "2019-11-29T14:48:56Z")

</div>

## Hello, Same problem for me. Please someone have an issue for this ?

number\_of\_guests=5 is\_even=“even”

## dispatcher.utter\_template(“utter\_even\_noteven”, tracker, number\_of\_guests=nb\_guest, even=is\_even)

I also tried to method which is not deprecated :

* * *

## dispatcher.utter\_message(template=“utter\_even\_noteven”, number\_of\_guests=nb\_guest, even=is\_even)

text: ‘You will be {number\_of\_guests} in total and its {is\_even}.’ There is my utter definition :

My bot print this : “You will be {number\_of\_guests} in total and its {even}.”

Looks like utter\_template does not fill kwargs of utter\_template method with var betweeen {} in the template.

Anyone have an idea ?

Thanks !

---

<div class="post-metadata">

**Author:** ![mishra-atul5001](https://avatars.discourse-cdn.com/v4/letter/m/41988e/32.png) [@mishra-atul5001](https://forum.rasa.com/u/mishra-atul5001)\
**Post date:** [May 22, 2020, 9:55am UTC](https://forum.rasa.com/t/pass-the-value-explicitly-when-calling-the-template/21117/3 "2020-05-22T09:55:17Z")

</div>

I am also facing the same issue. In my case, I’m picking a UserName from a DataFrame and want to display it in the **utter\_response** , but it’s not working. I guess we have to define the custom action, but I don’t want to do that. Just for displaying some static value, why we need to create custom action.

Any help?
