twiliotwilio-conversations

Fetching Twilio channel with new Conversations API


I have an application which is using old Chat API and in the documentation for Chat Channel Migration I saw that channels are automatically migrated to new Conversations API if they have a private type. Today I tried creating a private channel and fetching it via Conversation API's endpoint like this:

curl -X GET 'https://conversations.twilio.com/v1/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXX' -
u $TWILIO_ACCOUNT_SID:$TWILIO_ACCOUNT_TOKEN

However, I'm receiving this response:

{"code": 20404, "message": "The requested resource /Conversations/CHXXXXXXXXXXXXXXXXXXXXXXX was not found", "more_info": "https://www.twilio.com/docs/errors/20404", "status": 404}%

I've checked multiple times and confirmed that channel with such SID exists and it has private type (fetched along with other channels with old API).

channel mentioned above

Is there something I'm missing out?


Solution

  • Twilio Conversations have a default Conversation service, but I suspect when you migrate from Chat you will not be using the default service and instead should make API calls to the service-scoped Conversation resource.

    I believe the Chat Service SID is the SID you should use to scope the conversations. So try this request instead:

    curl -X GET 'https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXX/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXX' -
    u $TWILIO_ACCOUNT_SID:$TWILIO_ACCOUNT_TOKEN