使用' send_at'的错误带有Twilio计划Beta

发布于 2025-02-08 19:07:42 字数 1121 浏览 1 评论 0原文

我正在尝试通过Twilio安排短信。我正在参考此处找到的演示: https”> https ://www.twilio.com/docs/sms/api/message-resource#schedule-a-message-resource

根据演示,我通过Twilio Console设置了消息传递服务。

这是代码,带有虚拟目的地电话号码和授权:

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)

我会收到以下错误:

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

我缺少什么?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

放血 2025-02-15 19:07:44

检查您的 twilio hearper库库版本是当前的。

Check that your Twilio Helper Library version is current.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文