Thursday, 16 August 2018

Not able to get public channels

I am creating a small app using javascript SDK provided by twilio programmable chat , And I want to get the list of all the channels , To achieve this I am using getPublicChannelDescriptors() method.

below is the code:

$.getJSON(
    '/getToken?identity=' + identity + '&endpointId=' + endpointId,

    function (data) {

        console.log(data);
        chatClient = new Twilio.Chat.Client(data.token);

    chatClient.getPublicChannelDescriptors().then(function(channels) {

        //do something
    });
   }
 );

the error I am getting is below:

twilio-chat.min.js:149 Uncaught TypeError: Cannot read property 'getChannels' of null

I am getting data in response of ajax call and able to create chatClient succesfuly and also I am able to fetch all the channels subscribed by the user by using method getSubscribedChannels() but not able to get public channels.

Any help will be appreciated.



from Not able to get public channels

No comments:

Post a Comment