2

After the migration to new Conversations API,

When tried to fetch a channel with channel ID, I get the following error:

<TCHResult: 0x6000039e60e0> - code: 102; text: Conversation with given sid not found.

Here are the steps I followed:

First, Initialise the Chat Client with proper jwt token:

TwilioConversationsClient.conversationsClient(withToken: token, properties: nil, delegate: self) { (result, chatClient) in
 self.client = chatClient
 self.client?.delegate = self
}

Second, Get the channel ID from the backend, and try to fetch the channel with the ID. I made sure channel ID is valid and there is a pre-conversation exists for the chat before migration.

self.client?.conversation(withSidOrUniqueName: channelId, completion: { (result, conversation) in
   // Error here, conversation is nil
})

When I print the client details before fetching the channel, I get this:

client Optional(<<TCHUser: 0x6000038fe700>: identity: '100360', friendlyName: 'xxxxx', attributes: '<TCHJsonAttributes: 0x600003bcbe50>'>) Optional(2) Optional(2)

The user details and its sync status and connection state are all valid.

But I Still do not get the channel. Not sure what I missed.

Rups
  • 21
  • 5

1 Answers1

0

Before making calls to the client you should wait for synchronisation event.

Client would be fully functional after you receive .completed synchronisation status from – conversationsClient:synchronizationStatusUpdated:

Gray Wind
  • 56
  • 5