Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
236 views
in Technique[技术] by (71.8m points)

Twilio - Should I buy a new phone number?

I'm Kadir from Turkey. I'm working for a company. I want to send whatsapp messages all customers with whatsapp api. I'm using my own phone number for testing this code below. The "from" part in this code is default twilio sandbox number. I activated this sandbox with my own whatsapp. The problem is: I can send message to my own whatsapp. But I can't send message to another whatsapp number. Why this is happening? I want to send whatsapp message other persons also. Thanks for replies...

const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = require('twilio')(accountSid, authToken);

client.messages
      .create({
         from: 'whatsapp:+14155238886',
         body: 'Hello there!',
         to: 'whatsapp:+15005550006'
       })
      .then(message => console.log(message.sid));
question from:https://stackoverflow.com/questions/65896592/twilio-should-i-buy-a-new-phone-number

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The WhatsApp sandbox is designed for testing. So the people you are attempting to send WhatsApp messages must join the Sandbox by using the custom keyword assigned to your sandbox, i.e. join john-doe.

Once they join (opt-in for that dialog), you can send them free-form WhatsApp messages for 24 hours after their last inbound response (Session messages), as detailed here.

Once your application is vetted out, then you can apply for a WhatsApp number which doesn't have the join requirement and instead adheres to the the concepts of Template messages and Session Messages as detailed in the article above. You will then need to obtain proper opt-in from the consumers before sending WhatsApp messages.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...