Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(mostly) Completed NativeChat Cognitive Flow and Training JSON definition files for Rental Car Tutorial (https://www.progress.com/nativechat/chatbot-tutorial-intro)
{
"conversations": {
"welcome": {
"type": "support",
"steps": [
{
"type": "conversation",
"conversation": "help",
"conditions": [
"{{$not ($has conversation) }}"
]
}
]
},
"help": {
"type": "support",
"steps": [
{
"type": "message",
"messages": [
[
"If you get stuck, you can always restart our conversation by typing 'restart'"
]
]
}
]
},
"restart": {
"type": "support",
"steps": [
{
"type": "message",
"messages": [
"Your conversation is restarted."
]
},
{
"type": "conversation",
"conversation": "welcome"
}
]
},
"rent-car": {
"type": "goal",
"steps": [
{
"type": "message",
"messages": [
"Great, let me help find a car for you."
],
"conditions": [
"{{$not ($has startDate)}}"
]
},
{
"type": "question",
"entity": "startDate",
"entity-type": "Date",
"messages": [
"When would you like to pick up the car?"
],
"display": {
"type": "date-picker",
"title": "Find pick-up date",
"button-text": "Select"
}
},
{
"type": "question",
"entity": "endDate",
"entity-type": "Date",
"messages": [
"When would you like to drop off the car?"
],
"display": {
"type": "date-picker",
"title": "Find drop-off date",
"button-text": "Select"
},
"reactions": {
"validations": [
{
"type": "custom",
"parameters": {
"condition": "{{$gt endDate startDate}}"
},
"error-message": [
"Invalid value message"
]
}
]
}
},
{
"type": "question",
"entity": "country",
"entity-type": "Country",
"conditions": [
"{{$not ($has city)}}"
],
"messages": [
"Which country are you traveling to?"
],
"display": {
"type": "quick-reply"
},
"reactions": {
"acknowledgements": [
"Cool, I see you picked {{country}}.",
"I understand that you need a car in {{country}}."
],
"ambiguities": [
"I am not sure, which country do you need a car for. Can you select one of the following?",
"You mentioned these countries. Which country do you need a car for?"
],
"suggestions": [
"I see you tend to rent cars in {{country}}. Do you need a car in {{country}}?",
"Based on your previous choices. Would you like a car in {{country}}?"
]
}
},
{
"type": "question",
"entity": "city",
"entity-type": "City",
"messages": [
"In which city are you looking for a car?"
],
"display": {
"type": "single-select",
"title": "Find a city",
"button-text": "Select this city",
"data-source": {
"endpoint": "https://baas.kinvey.com/appdata/kid_r1275v_H4/Offices?query={\"country\": \"{{country}}\"}",
"method": "GET",
"headers": {
"Authorization": "Basic a2lkX3IxMjc1dl9INDo5YWYxOTcxZTFlY2U0NTNhYWUwOTQ2MzZlYmM5MGJlNw=="
}
},
"template": {
"title": "Office in {{name}}",
"subtitle": "{{country}}",
"value": "{{name}}",
"image": "https://demoapis.com/flags/{{country}}.png"
}
},
"reactions": {
"acknowledgements": [
"I see you want one of our cars in {{city}}.",
"We should have a car for you in {{city}}."
],
"validations": [
{
"type": "custom",
"parameters": {
"condition": "{{$or ($not ($has country)) ($eq city.country country)}}"
},
"error-message": [
"{{city}} is not in {{country}}. Please select a city in {{country}}."
]
}
]
}
},
{
"type": "question",
"entity": "car",
"entity-type": "Car",
"messages": [
"What car would you like?"
],
"display": {
"type": "carousel",
"title": "Find a car",
"button-text": "Select this car",
"data-source": {
"endpoint": "https://baas.kinvey.com/appdata/kid_r1275v_H4/Cars",
"method": "GET",
"headers": {
"Authorization": "Basic a2lkX3IxMjc1dl9INDo5YWYxOTcxZTFlY2U0NTNhYWUwOTQ2MzZlYmM5MGJlNw=="
}
},
"template": {
"title": "{{name}}",
"subtitle": "{{$currency price 'USD'}}",
"image": "{{imageUrl}}"
}
},
"reactions": {
"validations": [
{
"type": "custom",
"parameters": {
"condition": "{{$in car.id _response}}",
"data-source": {
"endpoint": "https://baas.kinvey.com/rpc/kid_r1275v_H4/custom/GetAvailableCars",
"method": "POST",
"headers": {
"Authorization": "Basic a2lkX3IxMjc1dl9INDo5YWYxOTcxZTFlY2U0NTNhYWUwOTQ2MzZlYmM5MGJlNw=="
},
"payload": {
"city": "{{city}}"
},
"selector": "$.cars[:].carID"
}
},
"error-message": [
"Unfortunatelly, {{car}} is not available in {{city}}. Try another car."
]
}
]
}
},
{
"type": "entities-confirmation",
"entity": "result-entity-name",
"entities": [
"startDate",
"endDate",
"city",
"car"
],
"messages": [
[
"Are these the correct details?",
"Press on any of the items you wish to update.",
"Press \"Confirm\" to complete the transaction."
]
]
},
{
"type": "webhook",
"entity": "order-response",
"data-source": {
"endpoint": "https://baas.kinvey.com/rpc/kid_r1275v_H4/custom/BookCar",
"method": "POST",
"headers": {
"Authorization": "Basic a2lkX3IxMjc1dl9INDo5YWYxOTcxZTFlY2U0NTNhYWUwOTQ2MzZlYmM5MGJlNw=="
},
"payload": {
"pickUpDate": "{{$date startDate 'D MMM YYYY'}}",
"dropOffDate": "{{$date endDate 'D MMM YYYY'}}",
"car": "{{car}}",
"price": "{{car.price}}",
"city": "{{city}}",
"email": "placeholder@email.com"
}
},
"messages": [
"Your car is booked. Your booking reference is {{order-response.bookingRef}}"
]
}
]
},
"drop-off-location": {
"type": "goal",
"steps": [
{
"type": "question",
"entity": "location",
"entity-type": "Location",
"messages": [
"Where did you leave the car?",
"Where can we find the car?",
"Can you show us on the location of the car on the map?"
],
"display": {
"type": "location-picker",
"title": "Pick a location",
"button-text": "The car is here"
}
},
{
"type": "message",
"messages": [
[
"Thank you.",
"We will pick up the car from: {{$json location}}",
"Have a nice day"
]
]
}
]
}
},
"settings": {
"invalid-replies": [
"I am not sure I understood what you said."
],
"general-failure": [
"We are experiencing technical difficulties at this moment."
],
"previous-conversation-messages": [
"I am going back to the {{ conversationDisplayName }} now."
]
},
"commands": {
"NEXT-PAGE": [
"Next 5"
],
"RESTART": [
"restart"
]
}
}
{
"entity-definitions": [
{
"data": [],
"dynamic-data": {
"data-source": {
"endpoint": "https://baas.kinvey.com/appdata/kid_r1275v_H4/Cars",
"headers": {
"Authorization": "Basic a2lkX3IxMjc1dl9INDo5YWYxOTcxZTFlY2U0NTNhYWUwOTQ2MzZlYmM5MGJlNw=="
},
"method": "GET",
"payload": {},
"selector": null
},
"synonym-templates": ["{{short-name}}"],
"value-template": "{{name}}"
},
"lookup-strategy": "keywords",
"name": "Car"
},
{
"data": [],
"dynamic-data": {
"data-source": {
"endpoint": "https://baas.kinvey.com/appdata/kid_r1275v_H4/Offices",
"headers": {
"Authorization": "Basic a2lkX3IxMjc1dl9INDo5YWYxOTcxZTFlY2U0NTNhYWUwOTQ2MzZlYmM5MGJlNw=="
},
"method": "GET",
"payload": {},
"selector": null
},
"synonym-templates": ["{{localName}}"],
"value-template": "{{name}}"
},
"lookup-strategy": "keywords",
"name": "City"
},
{
"data": [
{
"answers": ["Any time :)", "Just doing my job!", "You're welcome :)"],
"expressions": [
"I appreciate that",
"I know. thank you",
"I really appreciate it",
"awesome thanks",
"awesome thx",
"cool ty",
"good to know. thanks",
"great! thanks",
"great, thank you",
"many thanks",
"nice thanks",
"nice, thank you",
"ok thanks",
"ok thx",
"okay, thank you",
"sweet thanks",
"thank you buddy",
"thank you for showing me that",
"thank you so much",
"thank you very much",
"thank you",
"thank",
"thanks a lot",
"thanks again",
"thanks bot",
"thanks for the help",
"thanks for your help",
"thanks man",
"thanks you too",
"thanks",
"thankssssssssss",
"that's very kind",
"thnaks",
"thnx",
"thx dude",
"thx mate",
"thx",
"ty",
"you saved my day",
"you're good"
],
"value": "thanks"
},
{
"answers": ["Bye!", "Good bye!", "See you!"],
"expressions": [
"++",
"I go bye",
"I have to go",
"I said bye",
"I'll see you",
"I'm outa here",
"See you later",
"adieu",
"adios",
"au revoir",
"awesome see ya",
"best regards",
"best wishes",
"bye bye",
"bye now",
"bye",
"bye+",
"bye-bye",
"byebye",
"byeee",
"byeeeee",
"catch you later",
"cia",
"cool see you next time",
"cya l8er",
"cya",
"excellent bye",
"excellent bye-bye",
"good night",
"goodbye",
"goodnight then",
"got to go",
"great bye",
"gtg",
"hasta la vista",
"have a good day",
"have a great weekend",
"have a nice day",
"later",
"ok I have to go thanks",
"ok, bye",
"see u",
"see ya",
"see you soon",
"see you",
"see yu",
"so long",
"talk to you soon",
"tciao"
],
"value": "goodbye"
}
],
"lookup-strategy": "QnA",
"name": "SmallTalk"
},
{
"data": [
{
"expressions": [
"Are you intelligent?",
"Are you useless?",
"Can you help me?",
"Commands",
"Help me",
"Help me, please.",
"Help",
"How can I use you?",
"How can you help me?",
"I am lost",
"I don't know what to do",
"I need some assistance",
"I need some help !",
"I want to know more about you",
"Please help me",
"Show me what you do",
"What are my options?",
"What are you built for?",
"What are you doing?",
"What are your abilities?",
"What can I say?",
"What can you do?",
"What can you do?",
"What can you tell me?",
"What do you do?",
"What makes you unique?",
"What's your purpose?",
"What's your utility?",
"You're useless.",
"are you useful?",
"assist me",
"could you help me",
"give me help",
"help please?",
"how does this work?",
"how to",
"i am confused",
"i cant find the way i need help",
"i need help",
"list help",
"menu",
"more help",
"need guidance",
"need some guidance",
"not sure what to do here",
"show help",
"stop",
"what do you know to do?",
"what is this",
"what is your usage",
"what should I do?",
"what the bot knows to do?",
"who are you?"
],
"value": "help"
},
{
"expressions": [
"Can we reset the conversation?",
"Can we start over?",
"Forget about it, reset",
"Forget, restart",
"I want to reset the conversation",
"I want to start again",
"It is possible to restart the conversation?",
"Let's restart",
"Please reboot",
"Reboot the flow",
"can we start again?",
"let's do it again",
"reset conversation",
"reset",
"restart conversation",
"restart",
"restart, plase",
"start again"
],
"value": "restart"
},
{
"expressions": [
"Can you pick up the car?",
"I dropped off the car",
"The car is ready for pickup"
],
"value": "drop-off-location"
},
{
"expressions": [
"Do you have a car in?",
"I want a car in",
"I want to rent a car"
],
"value": "rent-car"
}
],
"lookup-strategy": "trait",
"name": "Conversation"
},
{
"data": [
{ "synonyms": ["Deutschland"], "value": "Germany" },
{ "synonyms": ["Italia"], "value": "Italy" },
{ "synonyms": ["Polska"], "value": "Poland" },
{ "synonyms": [], "value": "France" }
],
"lookup-strategy": "keywords",
"name": "Country"
},
{
"data": { "pattern": "[A-Za-z]{3}[0-9]{4}[A-Za-z]{2}" },
"lookup-strategy": "regex",
"name": "DrivingLicenseNumber"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment