从Twilio Channel获取受邀用户

时间:2017-09-11 18:53:14

标签: twilio twilio-api twilio-programmable-chat

我有一个Twilio频道,我试图让其受邀用户,但我不知道如何做到这一点:

    let messagingClient = this.state.messagingClient;
    messagingClient.getUserChannelDescriptors().then(channels => {
        let channelsHash = {};
        channels.items.map(channelDescriptor => {
            var channel = channelDescriptor.getChannel().then((channel) => {
            channelsHash[channel.uniqueName] = channel;
            console.log(channel.getInvited()) // print invited users
            });
        });

我会将channel.getInvited()替换为什么?似乎Twilio频道确实有这样的属性,因为这里有一个受邀资源:https://www.twilio.com/docs/api/chat/rest/invites#action-list

1 个答案:

答案 0 :(得分:1)

Twilio开发者传道者在这里。

我担心目前JavaScript SDK没有检索受邀用户的方法。为了立即获得此功能,您需要使用REST API。

从SDK中获取受邀用户是在积压工作中,因此请密切关注library releases

修改

使用REST API获取受邀成员:

from twilio.rest import Client

# Initialize the client
account = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
token = "your_auth_token"
client = Client(account, token)

# Retrieve the channel
channel = client.chat \
                .services("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \
                .channels("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
invites = channel.invites.list()