Cannot read properties of undefined (reading 'Airlines') Trevel chatbot

var elements = [context.details];
var message = {
“type”: “template”,
“payload”: {
“template_type”: “table”,
“text”: “Here are your flight details”,
“columns”: [
[“Airline”],[“FlightNo”], [“Airport”], [“Time”]
],
“table_design”: “regular”,
speech_hint: “Here are your flight details”,
elements: []
}
};
var ele = [];
for (var i = 0; i < elements.length; i++) {
var elementArr = [elements[i].Airlines, elements[i].FlightNo, elements[i].Airport, elements[i].Time];
ele.push({‘Values’: elementArr});
}
message.payload.elements = ele;
print(JSON.stringify(message));

@subhash.pandey ,

We would require more details to check this further:

  • When are you seeing the error “Cannot read properties of undefined (reading ‘Airlines’) Travel chatbot”?

  • How did you define “context.details”?

  • Which message template are you using?

Send us the relevant screenshots of the error and the code.

Regards,
Yoga Ramya,
Kore Support.

Hello @yogaramya.mendu thank you for your response, I got the solution, but while publishing the chatbot I am not able to get any response for the shared URL, kindly give me some guidance on this.