Error using 'send_at' with Twilio Schedule Beta

Viewed 47

I'm trying to schedule an sms via Twilio. I'm referencing the demo found here: https://www.twilio.com/docs/sms/api/message-resource#schedule-a-message-resource

Per the demo, I set up messaging service via the Twilio Console.

Here is the code, with a dummy destination phone number and authorizations:

from datetime import datetime
import os
from twilio.rest import Client


# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = [sid]
auth_token = [token]
client = Client(account_sid, auth_token)


message = client.messages \
    .create(
         messaging_service_sid= [msid],
         body='This is a scheduled message',
         send_at=datetime(2022, 6, 18, 20, 36, 27),
         schedule_type='fixed',
        #  status_callback='https://webhook.site/xxxxx',
         to='+15559698489'
     )

print(message.sid)

I get the following error:

TypeError: create() got an unexpected keyword argument 'send_at'

What am I missing?

1 Answers
Related