简体   繁体   中英

Python twilio send sms with hyperlink in body

The following script below works. How ever I cant find an example to create the "click here" a hyperlink to lets say www.amazon.com when someone touches it on there mobile device

import os
from twilio.rest import Client

# Your Account SID from twilio.com/console
account_sid = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
# Your Auth Token from twilio.com/console
auth_token  = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

client = Client(account_sid, auth_token)

message = client.messages.create(
    to="+19051234567", 
    from_="+19057654321",
    body="Summer Sale Click here 35% off")

print(message.sid)

"Click here" should be a link to amazon site.

SMS does not support hyperlinked text. The best you can do is to send the URL as part of the body of the SMS message.

message = client.messages.create(
    to="+19051234567", 
    from_="+19057654321",
    body="Summer Sale! For 35% off click here: https://example.org")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM