I have been working on Lex project recently. My project require dynamic content in content type but I am not able to figure that out.
My current fulfillment is:
"I can help you with : 1. Book a hotel 2. Book a car. What would you like me to do?"
What I require is :
"I can help you with:
1. Book a hotel
2. Book a car.
What would you like me to do?"
I have tried with below code:
def HelpMsg(intent_request, intent_name):
if intent_name == 'HelpMsg':
response = {
'dialogAction': {
'type': 'Close',
'fulfillmentState': 'Fulfilled',
'message': {'contentType': 'Plaintext', 'content': 'I can help you with '
'\n1. Book a hotel '
'\n2. Book a car'
'\nWhat would you like me to do?'}
}}
return response
Let me know if this is possible to do so.
Thanks
Rendering of the response depends on the client which you are using.
Lex console does not support new line.
FB Messenger will add new line using \n
:
I can help you with : \n1. Book a hotel \n2. Book a car. \nWhat would you like me to do?
Website will add new line using <br>
:
I can help you with : <br>1. Book a hotel <br>2. Book a car. <br>What would you like me to do?
You can add spacing as you like.
Refer this question for details.