I am not getting proper response from twilio.
Please make sure you have not made an error in your config file. Check if all your config values are correct and the run the code again and see if it works.
If it still gives you an error, please share the screenshot of your code, config and your Twilio config so that I can help you further.
Check the following :
- Make sure that you have setup twilio account correctly as mentioned in training-
Introduction to twilio
- You can also create a new project in twilio from scratch .
- Make sure that you set the right Credentials in conf file.
To get Credentials From Project Dashboard -
- SID & Auth Token :
- From Number :
- To Number :
Follow these codings
#API_KEY,This is your Bolt Cloud account API key API_KEY = 'api-key' #DEVICE_ID,This is the ID of your Bolt device DEVICE_ID = 'device-id' #You can find SID in your Twilio Dashboard SID = 'tiwlio-sid' #You can find on your Twilio Dashboard AUTH_TOKEN = 'auth-token' #This is the no. generated by Twilio. You can find this on your Twilio Dashboard FROM_NUMBER = 'from-number' #This is your number. Make sure you are adding +91 in beginning TO_NUMBER = '+91 to-number'
import conf from boltiot import Bolt, Sms, Email import requests # for making HTTP requests import json # library for handling JSON data import time # module for sleep operation minimum_limit = 235 maximum_limit = 238 mybolt = Bolt(conf.API_KEY, conf.DEVICE_ID) sms = Sms(conf.SID, conf.AUTH_TOKEN, conf.TO_NUMBER, conf.FROM_NUMBER) while True: print ("Reading sensor value") response = mybolt.analogRead('A0') data = json.loads(response) print("Sensor value is: " + str(data['value'])) try: sensor_value = int(data['value']) if sensor_value > maximum_limit or sensor_value < minimum_limit: print("Making request to Twilio to send a SMS") response = sms.send_sms("The Current temperature sensor value is " +str((100*sensor_value)/1024) + " degree celsious") print("Response received from Twilio is: " + str(response)) print("Status of SMS at Twilio is :" + str(response.status)) except Exception as e: print ("Error occured: Below are the details") print (e) time.sleep(10)
Hope this will solve your problem.
This suggestion helped me too!! Thank you
This solution helped me solve my error…Thank you!