有没有办法使用REST API将用户添加到Twilio频道?
from twilio.rest import Client
# Initialize the client
account = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
token = "your_auth_token"
client = Client(account, token)
# Update the channel
user = client.chat \
.services("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").users.list()[0]
channel = client.chat \
.services("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \
.channels("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").list()[0]
# How to add user to channel?
答案 0 :(得分:3)
Twilio开发者传道者在这里。
你可以add a member to a channel by creating a member resource using your user's identity。因此,您需要继续使用代码:
channel.members.create(user.identity)
如果有帮助,请告诉我。