Note: The A2P-registered 10DLC phone number is a standard 10-digit long code (10DLC) phone number added to a Messaging Service associated with a verified A2P campaign for messaging to the United States.
If a number is configured with a Messaging Service, you need to use the Messaging Service SID as the From identifier to ensure a contact's session is tracked correctly.
curl -X POST https://studio.twilio.com/v1/Flows/FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Executions \
--data-urlencode "To=<ToPhoneNumber>" \
--data-urlencode "From=<MessagingServiceSID>" \
-u "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token"
Studio keeps track of executions by their unique to/from address pair and uses this to look for active executions with which to associate incoming messages. When a Messaging Service calls the webhook for Studio, it provides that Service SID as the From identifier instead of the number itself.
For example, if you trigger a new flow from +15017122661 (which is associated with MG9752274e9e519418a7406176694466fa) to +15558675310, then Studio will supply +15017122661 as the From value when interacting with the Programmable Message API. Internally, Studio keeps track of this execution as a conversation between +15017122661 and +15558675310. When the Messaging Service then calls the Studio webhook, it supplies MG9752274e9e519418a7406176694466fa as the To value (reversed as this is an inbound message). Studio can’t find an existing execution between MG9752274e9e519418a7406176694466fa and +15558675310 and so a new execution is created.
Why do my messages come from different numbers?
If you have multiple numbers in your messaging service you also need to enable sticky sender for that service. Messaging services with multiple numbers will cycle through the available numbers to send a message. Enabling sticky sender will ensure the from number remains consistent throughout the conversation.