# RASA Bot utterance from CMS / DB

**URL:** <https://forum.rasa.com/t/rasa-bot-utterance-from-cms-db/6220>\
**Category:** Rasa Open Source\
**Created:** [March 21, 2019, 11:33am UTC](https://forum.rasa.com/t/rasa-bot-utterance-from-cms-db/6220 "2019-03-21T11:33:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tograssm](https://avatars.discourse-cdn.com/v4/letter/t/f475e1/32.png) [@tograssm](https://forum.rasa.com/u/tograssm)\
**Post date:** [March 21, 2019, 11:33am UTC](https://forum.rasa.com/t/rasa-bot-utterance-from-cms-db/6220/1 "2019-03-21T11:33:55Z")

</div>

Hello Community,

I’m trying to create an easy way to change the content of my bots utterances. So I added an endpoint like described [here](https://rasa.com/docs/core/responses/#managing-bot-utterances-using-an-external-cms)

```
action_endpoint:
  url: "http://localhost:5055/webhook"
nlg:
  url: http://localhost:80/utter.php # url of the nlg endpoint

```

My utter.php atm only returns the response for the first utterance for testing purposes, so it always returns following JSON (with MIME application/json):

```
{

          "text": "In welcher Phase des Projektes befindet ihr euch?",

          "buttons": [{"title": "Anfang", "payload": "/set_phase{\"Phase\": \"Anfang\"}"},

                      {"title": "Planung", "payload": "/set_phase{\"Phase\": \"Planung\"}"},

                      {"title": "Umsetzung", "payload": "/set_phase{\"Phase\": \"Umsetzung\"}"}],

          "image": null,

          "elements": [],

          "attachments": []

      }

```

which triggers following errormsg on the rasa core server:

```
2019-03-21 12:25:19 ERROR rasa_core.processor - Encountered an exception while running action 'utter_phase'. Bot will continue, but the actions events are lost. Make sure to fix the exception in your custom code.
2019-03-21 12:25:19 DEBUG rasa_core.processor - Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
  File "c:\users\media\documents\github\rasa_core\rasa_core\processor.py", line 346, in _run_action
    events = await action.run(dispatcher, tracker, self.domain)
  File "C:\Python36\lib\asyncio\coroutines.py", line 110, in __next__
    return self.gen.send(None)
  File "c:\users\media\documents\github\rasa_core\rasa_core\actions\action.py", line 153, in run
    tracker)
  File "C:\Python36\lib\asyncio\coroutines.py", line 110, in __next__
    return self.gen.send(None)
  File "c:\users\media\documents\github\rasa_core\rasa_core\dispatcher.py", line 134, in utter_template
    **kwargs)
  File "C:\Python36\lib\asyncio\coroutines.py", line 110, in __next__
    return self.gen.send(None)
  File "c:\users\media\documents\github\rasa_core\rasa_core\dispatcher.py", line 151, in _generate_response
    **kwargs)
  File "C:\Python36\lib\asyncio\coroutines.py", line 110, in __next__
    return self.gen.send(None)
  File "c:\users\media\documents\github\rasa_core\rasa_core\nlg\callback.py", line 112, in generate
    method="post", json=body, timeout=DEFAULT_REQUEST_TIMEOUT)
  File "C:\Python36\lib\asyncio\coroutines.py", line 110, in __next__
    return self.gen.send(None)
  File "c:\users\media\documents\github\rasa_core\rasa_core\utils.py", line 690, in request
    return await resp.json()
  File "C:\Python36\lib\asyncio\coroutines.py", line 110, in __next__
    return self.gen.send(None)
  File "C:\Python36\lib\site-packages\aiohttp\client_reqrep.py", line 1036, in json
    return loads(stripped.decode(encoding))
  File "C:\Python36\lib\json\ __init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "C:\Python36\lib\json\decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Python36\lib\json\decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2019-03-21 12:25:19 DEBUG rasa_core.processor - Action 'utter_phase' ended with events '[]'

```

Any idea what went wrong? Jsonlint tells me, that this is valid JSON, looking into your documentation, the content seems to be fine to - but still, I get this error and the message is not getting pushed to the [socket.io](http://socket.io) api

---

<div class="post-metadata">

**Author:** ![tograssm](https://avatars.discourse-cdn.com/v4/letter/t/f475e1/32.png) [@tograssm](https://forum.rasa.com/u/tograssm)\
**Post date:** [March 22, 2019, 1:40pm UTC](https://forum.rasa.com/t/rasa-bot-utterance-from-cms-db/6220/2 "2019-03-22T13:40:40Z")

</div>

I got it working now, but now, Slot Values wont get inserted into the template taken from my nlg server. is there a way, to treat the JSON as if it was written into the domain.yml - meaning, that these Slot Values are going to be filled in?

---

<div class="post-metadata">

**Author:** ![erohmensing](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/erohmensing/32/1789_2.png) [@erohmensing](https://forum.rasa.com/u/erohmensing)\
**Post date:** [April 1, 2019, 7:16am UTC](https://forum.rasa.com/t/rasa-bot-utterance-from-cms-db/6220/3 "2019-04-01T07:16:02Z")

</div>

@tograssm, can you add more information about your slot filling problem? Do you mean if your custom utterances have something like “Hello, {name}!” in them?

---

<div class="post-metadata">

**Author:** ![tograssm](https://avatars.discourse-cdn.com/v4/letter/t/f475e1/32.png) [@tograssm](https://forum.rasa.com/u/tograssm)\
**Post date:** [April 1, 2019, 9:19am UTC](https://forum.rasa.com/t/rasa-bot-utterance-from-cms-db/6220/4 "2019-04-01T09:19:10Z")

</div>

Yes. Exactly. Solved the problem by implementing a function in my NLG server, that replaces the SlotNames with it’s values. Is this intended?
