最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Twilio python sms ( not receiving any message on my phone number) - Stack Overflow

programmeradmin0浏览0评论

I am trying to send an SMS to my Nepal number using Twilio. When I execute python sms.py it executes without error (prints Message sent successfully!), but the message never arrives to my mobile phone. What could be the reason?

Here is my python code

from twilio.rest import Client

# Replace these with your actual Twilio credentials
TWILIO_ACCOUNT_SID = 'ACebf4aec20249287f6f5ea********'
TWILIO_AUTH_TOKEN = '91b077f750dbdd02412*******'
TWILIO_PHONE_NUMBER = '+1816371****'
RECIPIENT_PHONE_NUMBER = '+977981375****'


def send_text_message(message):
    try:
        # Create a Twilio client
        client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)

        # Send the SMS message
        client.messages.create(
            to=RECIPIENT_PHONE_NUMBER,
            from_=TWILIO_PHONE_NUMBER,
            body=message
        )

        print("Message sent successfully!")
    except Exception as e:
        print(f"Failed to send the message: {e}")


# Call the function to send the text message
message_to_send = "Hello, I am your msg"
send_text_message(message_to_send)

LOGS from Twilio

From (US) +1 8163718948 To (NP) +977 9813752995 Region United States (US1) Timestamp Elapsed time Twilio Platform Message Created 14:14:53 GMT+5:45 2025-02-02 —
Enqueued 14:14:53 GMT+5:45 2025-02-02 0.05 sec
Dequeued 14:14:53 GMT+5:45 2025-02-02 0.09 sec
Sent 14:14:53 GMT+5:45 2025-02-02 0.24 sec
Carrier Network Delivered 14:15:08 GMT+5:45 2025-02-02 15.33 secs
There were no HTTP Requests logged for this event.
发布评论

评论列表(0)

  1. 暂无评论