RASA Bot utterance from CMS / DB

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

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 api

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?

@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?

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