I am using a Twilio phone number and I am trying to do this:
Wherever some send a texto to my Twilio number, I want them to receive an automatic reply AND I want their SMS to be forwarded to another phone number.
I found this code for the auto-reply function
exports.handler = function (context, event, callback) {
const twiml = new Twilio.twiml.MessagingResponse();
twiml.message('Auto reply content');
callback(null, twiml);
};
And I also found this for the forwarding part:
exports.handler = function(context, event, callback) {
let twiml = new Twilio.twiml.MessagingResponse();
twiml.message(`${event.From}: ${event.Body}`, {
to: '+13105555555'
});
callback(null, twiml);
};
Now I wonder how I can make both of these actions at the same time.
I tried to mix both these codes but I receive the automatic-reply on the wrong phone number
user25985884 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.