Cross-Provider Workflow

Twilio SMS to SendGrid Email Escalation

Version 1.0.0

Send an SMS alert via Twilio, then escalate to an email via SendGrid.

1 workflow 2 source APIs 2 providers
View Spec View on GitHub ArazzoWorkflowsCross-Provider

Providers Orchestrated

twilio sendgrid

Workflows

sms-then-email-escalation
Send an SMS, then escalate the alert to email if delivery is not queued.
Sends an SMS notification through Twilio and inspects the returned message status. If the message is not accepted for delivery, the same alert is escalated to the recipient by email through SendGrid.
2 steps inputs: alertBody, fromNumber, recipientEmail, toNumber outputs: emailStatus, messageSid, messageStatus
1
send-sms
$sourceDescriptions.twilioMessagingApi.createMessage
Send the alert as an SMS message via Twilio.
2
escalate-email
$sourceDescriptions.sendgridMailApi.SendMail
Escalate the same alert to the recipient by email via SendGrid.

Source API Descriptions

Arazzo Workflow Specification

msg-twilio-sms-to-sendgrid-email-escalation.yml Raw ↑
arazzo: 1.0.1
info:
  title: Twilio SMS to SendGrid Email Escalation
  summary: Send an SMS alert via Twilio, then escalate to an email via SendGrid.
  description: >-
    A cross-provider notification workflow that first delivers a time-sensitive
    SMS to a user through Twilio's Messaging API and, when the message could not
    be queued for delivery, escalates the same alert to the user's inbox using
    SendGrid's Mail Send API. Demonstrates a primary-channel-plus-fallback
    notification pattern across two communications providers.
  version: 1.0.0
sourceDescriptions:
  - name: twilioMessagingApi
    url: https://raw.githubusercontent.com/api-evangelist/twilio/refs/heads/main/openapi/twilio-messaging-openapi.yml
    type: openapi
  - name: sendgridMailApi
    url: https://raw.githubusercontent.com/api-evangelist/sendgrid/refs/heads/main/openapi/tsg_mail_v3.yaml
    type: openapi
workflows:
  - workflowId: sms-then-email-escalation
    summary: Send an SMS, then escalate the alert to email if delivery is not queued.
    description: >-
      Sends an SMS notification through Twilio and inspects the returned message
      status. If the message is not accepted for delivery, the same alert is
      escalated to the recipient by email through SendGrid.
    inputs:
      type: object
      properties:
        fromNumber:
          type: string
        toNumber:
          type: string
        alertBody:
          type: string
        recipientEmail:
          type: string
    steps:
      - stepId: send-sms
        description: Send the alert as an SMS message via Twilio.
        operationId: $sourceDescriptions.twilioMessagingApi.createMessage
        requestBody:
          contentType: application/x-www-form-urlencoded
          payload:
            From: $inputs.fromNumber
            To: $inputs.toNumber
            Body: $inputs.alertBody
        successCriteria:
          - condition: $statusCode == 201
        outputs:
          messageSid: $response.body#/sid
          messageStatus: $response.body#/status
      - stepId: escalate-email
        description: Escalate the same alert to the recipient by email via SendGrid.
        operationId: $sourceDescriptions.sendgridMailApi.SendMail
        requestBody:
          contentType: application/json
          payload:
            personalizations:
              - to:
                  - email: $inputs.recipientEmail
                subject: Escalated alert
            from:
              email: [email protected]
            content:
              - type: text/plain
                value: $inputs.alertBody
        successCriteria:
          - condition: $statusCode == 202
        outputs:
          emailStatus: $statusCode
    outputs:
      messageSid: $steps.send-sms.outputs.messageSid
      messageStatus: $steps.send-sms.outputs.messageStatus
      emailStatus: $steps.escalate-email.outputs.emailStatus