Issue
When working with Group Conversations Classic in Twilio, some customers may encounter the error "50438: Group conversation with given participant list already exists". This error occurs when you try to create a new Conversation with the same set of participants that are already in an existing one.
Product
Twilio Conversations Classic
Cause
Imagine you have three users in your application: Alice, Bob, and Carol.
You create a Group Conversation with Alice, Bob, and Carol.
Later, your application attempts to create another Conversation with Alice, Bob, and Carol again.
Because a Conversation with that participant set already exists Twilio returns error 50438.
Resolution
One way to handle this is by locating the other conversation where the participant already exists the conversation causing the conflict and using that conversation instead, or by deleting or closing that conversation if it is no longer in use before adding the participant to a new conversation.
Another approach is to create the conversation with all participants in a single API call using the Conversation with Participants Resource. This prevents error 50438 by ensuring each participant is only added once.
Example using curl
curl -X POST "https://conversations.twilio.com/v1/ConversationWithParticipants" \
--data-urlencode "FriendlyName=Friendly Conversation" \
--data-urlencode "Participant={\"messaging_binding\": {\"address\": \"<External Participant Number>\", \"proxy_address\": \"<Your Twilio Number>\"}}" \
--data-urlencode "Participant={\"identity\": \"<Chat User Identity>\"}" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKENIn this example:
A new conversation called Friendly Conversation is created.
Multiple participants (external number and chat user) are added at the same time.
Because all participants are included in a single request, the chance of adding the same participant twice is eliminated.
Additional Information
For more information about the Conversation with Participants Resource, refer to Conversation with Participants Resource.