Created
February 13, 2024 02:06
-
-
Save mseeks/135bd4c380cd7278cd76ff149546da10 to your computer and use it in GitHub Desktop.
Python code to send an MMS with Twilio using an AAC audio file for compatibility with iOS devices.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from twilio.rest import Client | |
# Twilio credentials | |
account_sid = 'YOUR_ACCOUNT_SID' | |
auth_token = 'YOUR_AUTH_TOKEN' | |
# Your Twilio phone number | |
from_phone_number = 'TWILIO_PHONE_NUMBER' | |
# Recipient's phone number | |
to_phone_number = 'RECIPIENT_PHONE_NUMBER' | |
# URL of the AAC (.m4a) file | |
media_url = 'URL_TO_YOUR_AAC_FILE' | |
client = Client(account_sid, auth_token) | |
message = client.messages.create( | |
body="Here's an audio message for you!", | |
from_=from_phone_number, | |
to=to_phone_number, | |
media_url=[media_url] | |
) | |
print(f"Sent message with SID: {message.sid}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment