Search code examples
node.jstwiliotwilio-apitwilio-node

How to send custom notifications using twilio whatsapp without registering receiver's number?


I have followed the following steps from https://www.twilio.com/docs/sms/whatsapp/quickstart/node which works great with my the number I have registered with custom messages. Now I changed the number with another WhatsApp number I had but it's not sending messages to that. How do I send without registering? Please note that I have a trial account.

// This works
const whatsappMessage = await textTransport.messages
      .create({
        from: 'whatsapp:+14155238886',
        body: 'Hello there!',
        to: 'whatsapp:+91888888888' // registered number to twilin
      });
// This doesnt work
const whatsappMessage = await textTransport.messages
      .create({
        from: 'whatsapp:+14155238886',
        body: 'Hello there!',
        to: 'whatsapp:+91999999999'  // not registered
      });

Solution

  • Twilio developer evangelist here.

    The Twilio API for WhatsApp allows you to test using our sandbox. However, to send messages to your users without the sandbox restrictions you need to request your own WhatsApp enabled number.