1

Attempting to create a chat bot that will hit a web service midway through and ask questions based on previous responses.

I have created a function that will return an array of people that I will then text these names and ask the user to pick one.

Twilio Function

exports.handler = function(context, event, callback) {
 const employees = [{  name: 'Mark', id:15 }, {  name: 'Scott', id:16 }, {  name: 'Steve', id:17 }];
 callback(null, employees);
};

I would hope this would return function_1.parsed values, but everything is stored in function_1.body and I can't access it the way I hoped.

Here's a view of my Log.

enter image description here

Anyone know how I can send this to Parsed instead of body? If I submit a simple object it will return to the parsed value.

exports.handler = function(context, event, callback) {
 const employee = {  name: 'Mark', id:15 };
 callback(null, employee);
};

enter image description here

markokstate
  • 923
  • 2
  • 14
  • 28

1 Answers1

3

here is the trick, Wrap it in an object:

{"result":
   [{  name: 'Mark', id:15 }, {  name: 'Scott', id:16 }, {  name: 'Steve', id:17 }]
};
Alan
  • 10,465
  • 2
  • 8
  • 9