Twilio 仅通过 Python 从收件人处检索消息历史记录
Twilio retrieve message history from recipient only via Python
假设我有这段代码,它把 twilio 号码和它的收件人之间的所有消息历史记录放在一个数组中。有没有办法只从所有收件人而不是发件人(我是谁)检索消息历史记录
from twilio.rest import Client
account_sid = 'xxxx'
auth_token = 'xxxx'
client = Client(account_sid, auth_token)
text=[]
messages = client.messages.list()
for record in messages:
print(record.body)
text.append(record.body)
print(text)
有一些 filter criteria with the above command 的示例,您可以过滤到: 到您的特定 Twilio 号码,以仅查看对话的那一面(通过正文键)。
# Download the helper library from https://www.twilio.com/docs/python/install
from datetime import datetime
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/console
# DANGER! This is insecure. See http://twil.io/secure
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)
messages = client.messages.list(
to='+15558675310',
limit=20
)
for record in messages:
print(record.sid)
假设我有这段代码,它把 twilio 号码和它的收件人之间的所有消息历史记录放在一个数组中。有没有办法只从所有收件人而不是发件人(我是谁)检索消息历史记录
from twilio.rest import Client
account_sid = 'xxxx'
auth_token = 'xxxx'
client = Client(account_sid, auth_token)
text=[]
messages = client.messages.list()
for record in messages:
print(record.body)
text.append(record.body)
print(text)
有一些 filter criteria with the above command 的示例,您可以过滤到: 到您的特定 Twilio 号码,以仅查看对话的那一面(通过正文键)。
# Download the helper library from https://www.twilio.com/docs/python/install
from datetime import datetime
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/console
# DANGER! This is insecure. See http://twil.io/secure
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)
messages = client.messages.list(
to='+15558675310',
limit=20
)
for record in messages:
print(record.sid)