我正在尝试在此处逐字获取 Twilio 文档之后的对话。
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 = os.environ['TWILIO_ACCOUNT_SID']
auth_token = os.environ['TWILIO_AUTH_TOKEN']
client = Client(account_sid, auth_token)
conversation = client.conversations \
.conversations('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
.fetch()
这将返回一个:
HTTP 404 error: Unable to fetch record: The requested resource /Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX was not found
但是,如果我像这样提供对话服务 ID:
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 = os.environ['TWILIO_ACCOUNT_SID']
auth_token = os.environ['TWILIO_AUTH_TOKEN']
client = Client(account_sid, auth_token)
conversation = client.conversations \
.services("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
.conversations('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
.fetch()
我正确地得到了对话对象。在我的情况下,我使用 webhook 来捕捉参与者何时加入对话,因为该事件不返回服务 sid,只返回对话 sid,这使我想做的事情变得复杂。我错过了什么?