0

I use Laravel PHP, and I tried this:

$ucs = $twilio->chat->v2->services($this->serviceId)
            ->users($username)
            ->userChannels
            ->read(50);

but it seems to be getting only the channels that user has created, not including the ones where he is in the channel, but hasn't created the channel. How do I get all the channels where this user is in?

matiaslauriti
  • 7,065
  • 4
  • 31
  • 43
Vladimir Despotovic
  • 3,200
  • 2
  • 30
  • 58

1 Answers1

0

Twilio developer evangelist here.

The documentation says that:

The User Channel resource of Programmable Chat is a read-only resource that describes a Channel that the User is a Member of.

When you read the properties of a User Channel, you should find the status property which will tell you whether they have joined, been invited or are not_participating.

So, the User Channels resource should indeed return the channels a user is a member of.

If you are finding that the API request is not returning what the documentation describes, I would recommend getting in touch with Twilio support who can help you raise this.

One final point, I've noticed you're asking about Twilio Chat a few times. Twilio Chat is to be sunset on July 25, 2022 so that we can focus on the next generation chat powered by the Twilio Conversations API. There is a migration guide for upgrading from Chat to Conversations and I recommend that you try to use Conversations going forward.

philnash
  • 70,667
  • 10
  • 60
  • 88