Skip to content

Latest commit

 

History

History

README.md

Run Instructions

In order to run files located under this path you will need to follow a few steps. Runing them is very easy :)

Step 1 - Change credentials

Every example file contains the following block of the code:

// Load configuration file
var configuration = require('./configuration');

which loads configuration.js file located under the same path. File content is:

module.exports = {

    // A 36 character long Account Sid is always required. It can be described
    // as the username for your account
    account_sid : 'ACCOUNT_SID',


    // A 34 character long Auth Token is always required. It can be described
    // as your account's password
    auth_token  : 'AUTH_TOKEN',

}

ACCOUNT_SID and AUTH_TOKEN must be changed with real credentials which you can find at TelAPI dashboard

Step 2 - Change parameters ( if needed )

If you're trying to run the Send SMS example, you will need to update following block of code:

client.create(
    'sms_messages', 
    { 
        "From" : "(XXX) XXX-XXXX", 
        "To"   : "(XXX) XXX-XXXX", 
        "Body" : "Example message sent from TelAPI Node.JS helper"
    },
    function(response) { // SUCCESS CALLBACK
        util.log("SMS successfully sent. SMS SID: " + response.sid);
    },
    function(error) { // ERROR CALLBACK
        util.log("ERROR: " + error)
    }
);

where From and To must be real numbers.

Step 3 - Run the code!

There are many ways code can be run. Here is how you would run an example from the terminal:

cd telapi-nodejs/examples
node send_sms.js