All Articles

Fixing the 'Invalid Message Binding Address' error in Twilio Conversations

Published by Tony Vu on Jun 14, 2021

This article is part of the Twilio Conversations API series

If you try to add a conversation participant using an invalid phone number or a Twilio number like I have in the code example below, you will get the error Invalid messaging binding address with error code 50407.

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

This can happen if…

  • The value provided to the messagingBinding.address parameter is too long
  • The phone number provided is not in E.164 format
  • You are using a Twilio number instead of a mobile number

If #3 is the case, simply use the messagingBinding.projectedAddress parameter instead.

const participant = await client.conversations
  .conversations(conversation_sid)
  .participants.create({
    "messagingBinding.projectedAddressed": A_TWILIO_PHONE_NUMBER,
  });

This parameter adds a Twilio phone number as a SMS participant to a Conversation.

You can then programmatically send text messages to other participants in the Conversation. Other participants will see the text message message come from the Twilio phone number.

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