I add users to conversations through API REST. For example I do:
await client.conversations
.services(TWILIO_CHAT_SERVICE_SID)
.conversations(conversationSid)
.participants.create({ identity: myIdentity });
Consider that I need to delete users from conversation only through API REST. I found out here how to remove them by its sid. Is there any way to remove them by its identity? I need to do so because I don't keep trace of participant's sid into my DB. If I have to then I will.
So how would you face this problem?
I think you need the SID. Thankfully when you create a participant in the conversation, the API responds with the SID.
const participant = await client.conversations
.services(TWILIO_CHAT_SERVICE_SID)
.conversations(conversationSid)
.participants.create({ identity: myIdentity });
console.log(participant.sid);
So, when you create the participant, store their SID. Then when you need to update or delete them, you can fetch their SID from your own database.