However, I want to send message fields on New Lines in the body of the message example.
Name
Phone
Email
Age
I tried
Message body = “ Name “/n” Phone “/r/n” Email “ %0a ” Age
But none of the above escape variations above works, even tried with “double quotes” & ‘single quotes’
I greatly appreciate any help on this…
Thanks in advance.
Nev:
Basic code:
import twilio from ‘twilio’
let phone = “954 XXX XXXX”
let body = “First Line /r/n Second Line /r/n Third Line”
const accountSID = “Hidden for post”
const authToken = " Hidden for post "
const twilioNumber = “+1951 XXX XXXX”
export async function sendSms () // (phone, body)
{
let client = new twilio(accountSID, authToken)
let message = await client.messages.create({
body: body, // Dynamic value from incoming parameters
from: twilioNumber, // Twilio number
to: phone, // Dynamic value from incoming parameters
})
.then((message) => console.log(message.body));
}
I am using a Premium website, I also created a free wix website and configured it to send sms via Twilio. Same problem. The page does send the sms, however I am not able to achieve getting a line break to work with “\n” which is the common line escape, or any of the variations above…
I am wondering if it is a limitation on wix side, or twilio’s.
I searched the web for almost 36 hours to see if I could find a fix before reaching out to you .