Overview
When building communication workflows in Twilio Studio whether for WhatsApp, Webchat, or Voice developers often need to understand how unique identifiers (SIDs) are generated and related. This article explains the relationship between ExecutionSID, ConversationSID, and CallSID in Studio Flows, and clarifies how these behave across different channels and scenarios.
Key Concepts
-
ExecutionSID (FNxxxxxx):
A unique identifier for each run (execution) of a Studio Flow, regardless of channel. -
ConversationSID (CHxxxxxx):
A unique identifier for a messaging conversation, such as WhatsApp or Webchat. -
CallSID (CAxxxxxx):
A unique identifier for a voice call.
What You Need To Know
How SIDs Are Generated in Studio Flows
- When Are SIDs Created?
- Every time a user initiates a Studio Flow, an ExecutionSID is generated.
- If the interaction is via voice (phone call), a CallSID is created.
- If the interaction is via messaging (WhatsApp, Webchat, SMS, etc.), a ConversationSID is created.
- Is There Always a 1:1 Relationship?
Typically, yes: Each ExecutionSID is associated with a unique ConversationSID (for messaging) or CallSID (for voice).
Exceptions:
- If a user re-enters the same flow (e.g., sends a new message after completing a flow), a new ExecutionSID is generated.
- If the underlying conversation (e.g., WhatsApp session) is still open (such as within the 24-hour WhatsApp window), the ConversationSID may remain the same, but a new ExecutionSID is created for each new flow execution.
- If a conversation is routed to an agent (e.g., via SendToFlex) and the task is completed, a new ConversationSID will be generated for subsequent interactions, even within the 24-hour window.
- Channel-Specific Behaviors
- If your customer completes a Studio Flow and sends a new message within the 24-hour WhatsApp session window:
- If the previous task (agent interaction) is still open: The ConversationSID remains the same.
- If the task is completed (conversation closed): A new ConversationSID is generated for the next interaction.
Webchat
- Each new Webchat session generates a new ConversationSID and ExecutionSID, regardless of browser cache or user identifier.
- There is always a 1:1 relationship between ExecutionSID and ConversationSID for Webchat.
Event Streams and SID Correlation
Event Streams do not provide a single event containing both the ExecutionSID and ConversationSID/CallSID together. To correlate these:
- Subscribe to Studio Events to obtain the ExecutionSID.
- Use the Studio Execution Context API to fetch the associated ConversationSID or CallSID.
Conclusion
| Channel | New ExecutionSID per Flow? | New ConversationSID per Interaction? | Notes |
|---|---|---|---|
| Yes | Only if previous task is completed | Within 24h, ConversationSID persists unless agent task is closed | |
| Webchat | Yes | Yes | Always 1:1 between ExecutionSID and ConversationSID |
| Voice Call | Yes | N/A (uses CallSID) | Each call generates a new CallSID and ExecutionSID |
Best Practices
- For reliable tracking, always log both ExecutionSID and ConversationSID/CallSID in your application.
- For advanced correlation, use the Studio Execution Context API to map ExecutionSIDs to ConversationSIDs or CallSIDs as needed.
- Understand channel behaviors to design flows that meet your business and reporting requirements.
Below you will find references to useful documents: