Carriage returns and Dialogflow

#1

Hi

I’m using Dialogflow to return some speech (under text response). However any new lines / carriage returns are removed when the text is shown in the messenger window. Are there any special characters that can be passed or similar to work around this and keep the new lines?

Nick

#2

Hi

I fixed this myself. If you use the API with a querystring (https://api.dialogflow.com/v1/query?v=20170712) you’ll also get fulfillment which contains the speech with the line breaks. Then this can be accessed like this:

{{make_a_http_request_call_dialogflow_api_for_nlp.data__result__fulfillment__messages__0__speech}}

rather than this

{{make_a_http_request_call_dialogflow_api_for_nlp.data__result__speech}}

Hope this helps!

Nick

1 Like