1

I have a studio flow I have a run function widget in it ,and I am forwarding sms to another number by this function(given below)

Now as a pararmeter to this function I have provide sender={{contact.channel.address}}. Which actually should provide sms senders number. But in reality its (calling event.sender in function) creating a strange string like this sms_4yx0zwp2imdvyezjogf3vg1nj3dmarei.

exports.handler = function(context, event, callback) {

const twilioClient = context.getTwilioClient();
  let from =+xxxxxx //
   let to = ${event.forwardTo};
   let body = A sms from ${event.sender}: ${event.text};
   //the event.sender above line creating strange string
 twilioClient.messages
  .create({
   body: body,
    to: to,
    from: from,
       })
       .then((message) => {
          console.log('SMS successfully sent');
          console.log(message.sid);
          return callback(null, 'success');
              })
           .catch((error) => {
            console.log(error);
                return callback(error);
         });

            };
  • I assume you are using Twilio Flex? If so, there are other attributes in the payload that contain the actual From number. – Alan Apr 26 '21 at 11:26
  • tried {{trigger.message.From}} didn't work. What worked is adding a Random string infront of {{contact.channel.address}} – Jobayer Shajal Apr 26 '21 at 11:32
  • Are you using Flex? – Alan Apr 26 '21 at 11:41
  • If you are using Flex, look under the logs for your Studio Flow executions (Widget & Flow Properties), you will see the attributes sent into the flow. It looks like you are after {{trigger.messsage.ChannelAttributes.from}} – Alan Apr 26 '21 at 11:44
  • hi, I am using flex.I will look into {{trigger.messsage.ChannelAttributes.from}} .Probably this will be the solution – Jobayer Shajal Apr 27 '21 at 06:38
  • 1
    Hi, I am actually trying to get it work it in a studio IVR that is connected to flex proxy service. I tried with {{trigger.messsage.ChannelAttributes.from}}. that actually gives empty body – Jobayer Shajal Apr 30 '21 at 06:00

0 Answers0