0

How can I get all conversations in an active state?

I'm using this command to list all conversation SIDs, but I can't find a way to filter only the active ones.

twilio api:conversations:v1:services:conversations:list \
    --chat-service-sid ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \
    --properties sid,state --limit=100

In help command I see it has a page-size=<value> parameter, but there's no way to specify which page to retrieve

twilio api:conversations:v1:services:conversations:list --help

Console output image

1 Answers1

1

Unfortunately don't have a method to filter conversations by the status on search conversations API. But you can list all conversations and filter just conversations with the status "active". Follow and example using the Twilio CLI:

  • you can use the -no-limit to bring all conversations without paginating
twilio api:conversations:v1:conversations:list --no-limit --properties sid,state | grep active

I hope that it can help you :D.

csevero
  • 361
  • 1
  • 8
  • The --no-limit parameter is too slow, how do I use pagination? I can specify page-size, but not the actual page I need. Thank you – Neuquino Jan 09 '23 at 07:44
  • Via CLI this is a little complicated to work with pagination, but you can create a script using Javascript to do it. But in the end, the result will be the same, you'll need to iterate by all conversations to check if it is active or not. – csevero Jan 09 '23 at 21:34