Sms status : queued

I have created a twilio account, as required to send sms for temperature detection on the Bolt device. The code, as mentioned in the tutorials, correctly prints the temperature & the function to send the sms also works without errors. However, I do not get any sms on my entered mobile number, and the message status as printed in the terminal is : queued. Even upon waiting no sms is ever delivered & the message status contines to be queued. What would be a possible fix for this ?

It could probably be the issue at Twilio’s end.
I suggest you to check the logs list at your Twilio account Dashboard.
(It could be found at the bottom of the page).

If they show the message as delivered, then the problem resides at the network end.
In that case, put your phone at flight mode for few seconds and then switch it off.
Try running the code again.

Perhaps this could resolve the problem.

Thank you but the problem seems to persist. The twilio log shows status : sent (not delivered tho! or is it the same thing?). To check if my network is at fault, I just sent a plain sms from another of my phone to the phone that was supposed to receive the twilio messages. My phone (in question) clearly received the sms that I had sent, but none of those twilio messages were detected. Is it because twilio uses an international number, maybe ?

1 Like

Hi @ee17b110,

One of the reason could be DND. Check if you have enabled the DND on your number http://www.nccptrai.gov.in/nccpregistry/search.misc

Hi @ee17b110 ,

If the twilio log is showing the status as sent, it means the sms is sent from the twilio’s end.

In that case, I would also suggest you to check whether DND is enabled on your number.

Because the problem seems to be residing at your operator end.

Thanks to all of you. It was not DND though. I received those sms today morning when those sms’ were sent yesterday evening. Not the best situation because I tried texting myself from another phone & those texts were received almost instantly on my phone (same phone that received twilio sms’ 10 hours later )

1 Like

Hi @choudharyaakash066,

When you sent the sms form your phone, it is considered as transactional sms and it carries a very high priority for delivery.

But if you use the external services to send the sms then there are two types of sms.

  1. Promotional (offers, news etc)
  2. Transactional (For bank account activity, password reset)

By default, Twilio provides the promotional sms, in promotional sms they have two variants - Free user and paid user. Off-course paid user will get the high priority in the queue.

For the Transactional sms, you have to fill a form and your have to provide a sms template to the Twilio team and only paid user can apply for the Transactional sms.

Note: You will not receive the Promotional sms between 9 PM to 9 AM.

1 Like

Well then, with an unpaid twilio account, the project (in the Bolt training) involving the alerting of users on threshold breach is highly impractical. If the sms’ take that long to arrive (7-10 hours), should we look for other message api platforms that provide a better priority delivery ?

Hi @ee17b110,

You can try out this https://www.karix.io/. But there is high probability that you might face the issue here also.

Do let me know in case you need the code snippet for https://www.karix.io/

@rahul.singh1, could you send me the snippet for karix.io. I’d like to check it out too.

1 Like

Yes, I forgot to ask @rahul.singh1. Code snippet preferred.

Hi @pankajkumar.p and @ee17b110,

Refer the code below using request library and here is the documentation http://docs.karix.io/v2/#tag/Message. You will get the ACCOUNT ID and ACCOUNT TOKEN after creating your account on https://cloud.karix.io

import base64
import requests

url = "https://api.karix.io/message/"

username = "Copy your ACCOUNT ID"
password = "Copy your ACCOUNT TOKEN"



auth_str = '%s:%s' % (username, password)

b64_auth_str = base64.b64encode(auth_str)

Authorization = 'Basic %s' % b64_auth_str

print(Authorization)

payload = '{"channel":"sms","source":"+14154009186","destination":["+917768098790"],"content":{"text":"Testing the karix- Bolt IoT."},"events_url":"https://events.example.com/message"}'

headers = {
    'Content-Type': "application/json",
    'Authorization': Authorization,
    'Accept': "*/*",
    'Cache-Control': "no-cache",
    'Host': "api.karix.io",
    'accept-encoding': "gzip, deflate",
    'content-length': "211",
    'Connection': "keep-alive",
    'cache-control': "no-cache"
    }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)  

You can also use the Karix pip packages. Check this link https://blog.karix.io/how-to-send-an-sms-using-python-helper-library

2 Likes

yes it takes around a night sometimes to deliver the msg i had got the same problem received the sms next morning

In the bolt module Twilio section it is specified that it is not obvious that you will get the sms or it may take some time it is the problem at the Twilio end.

I checked my number for DND. It shows “never registered”. Can i resolve this problem from my side?