Skip to content Skip to sidebar Skip to footer

How To Listen For New Message From Multiple Channels In Twilio Programmable Chat?

I have an instant messaging web application using twilio programmable chat with 'n' number of private channels subscribed by a member. I am using twilio chat javascript library. Ho

Solution 1:

Use 'mesageAdded' event on the chat client object

Twilio.Client.create(token).then(client => {
    this.chatClient = client
    this.chatClient.getSubscribedChannels().then(function (paginator) {
        console.log(paginator.items)
    })

    this.chatClient.on('messageAdded', function (message) {
        console.log(message)
    })
});

Post a Comment for "How To Listen For New Message From Multiple Channels In Twilio Programmable Chat?"