All Articles

Twilio Conversations - Conversation Autocreation

Published by Tony Vu on Jun 25, 2021

This article is part of the Twilio Conversations API series

Conversation autocreation is a setting that is off by default and can be turned on within your Twilio console.

Twilio Conversations Autocreation in the console setting

It automatically creates a new Conversation for inbound messages that arrive on your Twilio phone number’s if the following conditions are true

  1. The sender’s phone number is not already added as a participant to a Conversation via the conversation.participants.create parameter “messagingBinding.Address”
  2. The Twilio phone number receiving this message is not already added as a participant via the conversation.participants.create parameter “messagingBinding.proxyAddress”

When an inbound SMS message is sent to a Twilio phone number, it will either call the programmable messaging webhook URL configured on the Twilio phone number or arrive in a Conversation. It will arrive in a Conversation if the Twilio phone number receiving the messaging and the phone number sending the message are bound together in a Conversation. This binding exists when a Conversation Participant is created in the following way

const participant = await client.conversations
  .conversations(conversation_sid)
  .participants.create({
    "messagingBinding.address": A_MOBILE_NUMBER,
    "messagingBinding.proxyAddress": YOUR_TWILIO_PHONE_NUMBER,
  });

When no such Conversation Participant exists or if one wasn’t created using a code example like the one above, incoming messages to your Twilio phone number will invoke the Programmable Messaging webhook URL, if you have one defined, in your Twilio console.

You can change this behavior by activating Conversation Autocreation in your Twilio console.

So when should you turn on the Conversation Autocreation setting?

  • Turn on Conversation Autocreation only when you are ready to stop triggering SMS webhooks to your Twilio phone number from a given mobile number and instead move them to a Conversation

Interested in learning more about Twilio Conversations? Check out my upcoming eBook on Twilio Conversations and other articles.