twiliotwilio-apitwilio-studio

Triggering a Twilio flow execution to a contact channel address while another execution to the same number is still active


Triggering a twilio flow execution to the same number while another execution is still in progress will send a response of the same execution id without any indication that this execution is not a new execution:

This is the response of the first trigger of the execution:

 {
   status: 'active',
   date_updated: null,
   contact_channel_address: 'xxxxx',
   account_sid: 'xxxx',
   url: 'https://studio.twilio.com/v1/Flows/xxxx/Executions/FN519a25c6d932799cb8d1dc5bf78b489c',
   context: {},
   sid: 'FN519a25c6d932799cb8d1dc5bf78b489c',
   date_created: '2022-05-18T11:53:31Z',
   contact_sid: 'xxx',
   flow_sid: 'xxx',
   links: {
     steps: 'https://studio.twilio.com/v1/Flows/xxx/Executions/FN519a25c6d932799cb8d1dc5bf78b489c/Steps',
     execution_context: 'https://studio.twilio.com/v1/Flows/xxx/Executions/FN519a25c6d932799cb8d1dc5bf78b489c/Context'
   }

This is the response of the second trigger of the execution:

{
   status: 'active',
   date_updated: null,
   contact_channel_address: 'xxx',
   account_sid: 'xxx',
   url: 'https://studio.twilio.com/v1/Flows/xxx/Executions/FN519a25c6d932799cb8d1dc5bf78b489c',
   context: {},
   sid: 'FN519a25c6d932799cb8d1dc5bf78b489c',
   date_created: '2022-05-18T11:53:32Z',
   contact_sid: 'xxx',
   flow_sid: 'xxx',
   links: {
     steps: 'https://studio.twilio.com/v1/Flows/xxx/Executions/FN519a25c6d932799cb8d1dc5bf78b489c/Steps',
     execution_context: 'https://studio.twilio.com/v1/Flows/xxx/Executions/FN519a25c6d932799cb8d1dc5bf78b489c/Context'
   }
 }

Solution

  • Use v2 of the Executions resource, it will return a 409 response.

    Differences Between v1 and v2