Search code examples
twilio-conversationstwilio-cli

How to list all active conversation SIDs?


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


Solution

  • 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.