Getting started

To start sending SMS with Node.js you need to do the following:

  1. Create a 46elks account
  2. Purchase some credits. (The minimum purchase is 10 EUR, which is more than enough to get started.)
  3. Locate your API-credentials

Write your Node.js code

Now it's time to build our simple script to be able to send an SMS and and it all revolves around making an HTTP request.

Node.js has different libraries for making an HTTP request, and below we show how to do it with "query string" and "requests". Choose the one that suits you best.

Node.js query string library

An example using node.js and the query string library


    
Node.js requests library

An example using node.js and the requests library


    

To be able to send an SMS, you need to replace the following with your own information:

Some tips on SMS parameter formatting:

The basic API request to send an SMS must contain these three key:value pairs: to, from and message.

  • The to parameter should be the E.164 formatted number of the recipient.
    Example: +46766861004.

  • The from parameter should be either an E.164 number or a string. That string is often called "Text sender ID" or "alphanumeric sender ID".
    Example: +46766861004, ElkCo

  • The message parameter is the content of the SMS itself and can consist of numbers, letters, and other characters. You can even send emojis.
    Exemple: How was this interview, 👌🏽 or 👎🏽 ?

Send SMS

Now you can run your code. If you are using the terminal it will look like this:


    

If successful, you should expect a result similar to this:


    

Next step

You've just sent a text message with a text sender (i.e. not from a phone number). By doing this you can use SMS to remind customers of reservations, send confirmations of new orders, etc.

To send an SMS is the easiest way to get started with 46elks, but you can do so much more. For example you can receive SMS, automatically respond to an incoming SMS or handle voice calls. There are more Node.js code examples at GitHub.

If you have any questions then get in touch, we love talking to our users!