I am using the @twilio/conversations library in a NextJS + React application. After successfully connecting with an Access Token, I am able to interact with the Client object normally and get participants, conversations, users, etc.
import { Client } from "@twilio/conversations"
const client = new Client(token)
However, when I try to add a participant I am receiving a Forbidden error. The current authenticated user is already a part of the conversation. I am trying to add a different, second user to the conversation. It doesn't matter which conversation or which user I attempt to add as a participant, the error is the same.
const conversation = await client.getConversationByUniqueName(conversationUniqueName)
const res = await conversation.add(userIdentity)
Uncaught (in promise) Error: Forbidden
at Upstream._callee$ (browser.js?5550:2968:1)
at tryCatch (regeneratorRuntime.js?6f37:86:1)
at Generator.eval [as _invoke] (regeneratorRuntime.js?6f37:66:1)
at Generator.eval [as next] (regeneratorRuntime.js?6f37:117:1)
at asyncGeneratorStep (asyncToGenerator.js?8e4b:3:1)
at _next (asyncToGenerator.js?8e4b:25:1)