The code below give an error, “ERROR: the index ‘http’ does not exist”.
I’m following the sample.
Output when running the device code (see following):
2020-08-08T00:57:13.561 +00:00 | [Status] | Agent restarted: reload.
-- | -- | --
2020-08-08T00:57:15.449 +00:00 | [Status] | Device disconnected
2020-08-08T00:57:15.549 +00:00 | [Status] | Downloading new code; 2.37% program storage used
2020-08-08T00:57:15.643 +00:00 | [Device] | ERROR: the index 'response' does not exist
2020-08-08T00:57:15.644 +00:00 | [Device] | ERROR: in main device_code:9
Code I’m using:
#require "Twilio.class.nut:1.0.0"
local twilio = Twilio(
__VARS.ACCOUNT_SID,
__VARS.ACCOUNT_AUTH_TOKEN,
__VARS.ACCOUNT_PHONE_NUMBER
);
local recipientsNumber = __VARS.MY_PHONE_NUMBER;
local textMessage = "Hello there #1";
local response = twilio.send(recipientsNumber, textMessage);
server.log(response.statuscode + ": " + response.body);
I also tried with hard coded values:
#require "Twilio.class.nut:1.0.0"
twilio <- Twilio(
"AC_________________________________",
"_________________________________",
"+1650________1"
);
recipientsNumber <- "+1650________2";
textMessage <- "Hello there #1";
response <- twilio.send(recipientsNumber, textMessage);
server.log(response.statuscode + ": " + response.body);
Note, I am a Twilio support engineer. I’m confident the account values are correct.