0

I'm trying to send a SMS message for the android SMS Retriever API which has to be in this format:

<#> Your Example app code is: 123ABC78
/f8Escobih1Z

But the line break after the code doesn't seem to work. Here is my code:

await twilio.messages
        .create({
            body: `<#> ${code}
            /f8Escobih1Z`,
            from: process.env.TWILIO_PHONE,
            to: phoneNumber
        })

I've tried a normal line break like above or adding \n or \r\n, but nothing seems to work. Does anybody know what I'm doing wrong?

router360
  • 21
  • 1
  • 4
  • '/n' should work, it works for me like `client.messages.create({ body:'hi \n hi', to: process.env.MY_PHONE_NUMBER, from: 'YOUR-TWILIO-NUMBER' })` – lizziepika Mar 03 '21 at 05:30
  • I tried that but it just renders it as white space. Funny thing is, it was working with the trial credits but as soon I as I upgraded it stopped working. – router360 Mar 03 '21 at 07:05
  • I just tried this with the line break in back ticks and it worked for me. Is there anything else you're doing? If it was the difference between sending on a trial account and upgraded account, then perhaps you should get in touch with [Twilio Support](https://www.twilio.com/help/contact) and share some SMS SIDs where it worked and where it didn't. – philnash Mar 05 '21 at 04:01

0 Answers0