Cross-Provider Workflow

Twilio Lookup then SMS

Version 1.0.0

Validate a phone number with Twilio Lookup, then send an SMS to it.

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

Providers Orchestrated

twilio

Workflows

lookup-then-send-sms
Validate a phone number, then send an SMS to it.
Looks up a destination phone number with Twilio Lookup and, on a valid number, sends an SMS notification to it through Twilio Messaging.
2 steps inputs: fromNumber, messageBody, phoneNumber outputs: messageSid, validatedNumber
1
lookup-number
$sourceDescriptions.twilioLookupApi.fetchPhoneNumber
Validate the destination phone number with Twilio Lookup.
2
send-sms
$sourceDescriptions.twilioMessagingApi.createMessage
Send the SMS notification to the validated number.

Source API Descriptions

Arazzo Workflow Specification

msg-twilio-lookup-then-sms.yml Raw ↑
arazzo: 1.0.1
info:
  title: Twilio Lookup then SMS
  summary: Validate a phone number with Twilio Lookup, then send an SMS to it.
  description: >-
    A workflow that first validates a destination phone number through the
    Twilio Lookup API and then, on a valid number, sends an SMS notification to
    it through the Twilio Messaging API. Demonstrates gating a messaging action
    behind a number-validation check across two Twilio APIs in a single Arazzo
    workflow.
  version: 1.0.0
sourceDescriptions:
  - name: twilioLookupApi
    url: https://raw.githubusercontent.com/api-evangelist/twilio/refs/heads/main/openapi/twilio-lookup-openapi.yml
    type: openapi
  - name: twilioMessagingApi
    url: https://raw.githubusercontent.com/api-evangelist/twilio/refs/heads/main/openapi/twilio-messaging-openapi.yml
    type: openapi
workflows:
  - workflowId: lookup-then-send-sms
    summary: Validate a phone number, then send an SMS to it.
    description: >-
      Looks up a destination phone number with Twilio Lookup and, on a valid
      number, sends an SMS notification to it through Twilio Messaging.
    inputs:
      type: object
      properties:
        phoneNumber:
          type: string
        fromNumber:
          type: string
        messageBody:
          type: string
    steps:
      - stepId: lookup-number
        description: Validate the destination phone number with Twilio Lookup.
        operationId: $sourceDescriptions.twilioLookupApi.fetchPhoneNumber
        parameters:
          - name: PhoneNumber
            in: path
            value: $inputs.phoneNumber
          - name: Fields
            in: query
            value: validation
        successCriteria:
          - condition: $statusCode == 200
          - condition: $response.body#/valid == true
        outputs:
          validatedNumber: $response.body#/phone_number
      - stepId: send-sms
        description: Send the SMS notification to the validated number.
        operationId: $sourceDescriptions.twilioMessagingApi.createMessage
        requestBody:
          contentType: application/x-www-form-urlencoded
          payload:
            From: $inputs.fromNumber
            To: $steps.lookup-number.outputs.validatedNumber
            Body: $inputs.messageBody
        successCriteria:
          - condition: $statusCode == 201
        outputs:
          messageSid: $response.body#/sid
          messageStatus: $response.body#/status
    outputs:
      validatedNumber: $steps.lookup-number.outputs.validatedNumber
      messageSid: $steps.send-sms.outputs.messageSid