SMS Messaging with Twilio Using Electric Imp

I recently purchased an imp006 Development Board. To use the cellular connection aspect of the board via the Super Sim I had to setup a Twilio account. While exploring around Twilio I want to take advantage of it’s SMS messaging capabilities in my Electric Imp project. For my project I found the Twilio.class.nut:1.0.1 class library. The class documentation has some sample code:

#require “Twilio.class.nut:1.0.1”
twilio ← Twilio(accountSID, authToken, twilioNumber);
recipientsNumber ← “15555555555”;
textMessage ← “Hello World!”;

// Send the message synchronously
local response = twilio.send(recipientsNumber, textMessage);
server.log(response.statuscode + ": " + response.body);

// Send it again, this time asynchronously
twilio.send(recipientsNumber, textMessage, function(response) {
server.log(response.statuscode + " - " + response.body);
});

When I excute the agent code right off the bat I run into a snag on the first line:

twilio ← Twilio(ABC, DEF, 555)

I provided the actual parameters requested found on the newly created Twillo account but I get the following error:
ERROR: the index ‘ABC’ does not exist. The ABC here is representing my actual TWILIO_SID for the purpose of security in asking the question.

Any idea why I am getting the error? Does anyone have any experience using Twillio SMS and the
Twilio.class.nut:1.0.1 class?

Thanks in advance for any help.

A thought: are you passing the SID, token and phone number values as strings, ie. within double quotes?

twilio ← Twilio("ABC", "DEF", "555");

I’ve updated the library docs to clarify this.

That did the trick!!!
Thanks so much.

This topic was automatically closed after 60 days. New replies are no longer allowed.