Cross-Provider Workflow

Square Customer and Order to SendGrid Confirmation

Version 1.0.0

Create a Square customer, place a Square order for them, then email a confirmation with SendGrid.

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

Providers Orchestrated

block sendgrid

Workflows

square-customer-order-confirm
Create a Square customer, place an order, and email a SendGrid confirmation.
Creates a Square (Block) customer, places an order for them at a location, then emails an order confirmation to the customer via SendGrid.
3 steps inputs: email, givenName, idempotencyKey, itemName, locationId outputs: customerId, emailStatus, orderId
1
create-customer
$sourceDescriptions.blockApi.create-customer
Create the customer in Square.
2
create-order
$sourceDescriptions.blockApi.create-order
Place a Square order for the customer at a location.
3
email-confirmation
$sourceDescriptions.sendgridApi.SendMail
Email the customer an order confirmation via SendGrid.

Source API Descriptions

Arazzo Workflow Specification

shop-square-order-customer-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Square Customer and Order to SendGrid Confirmation
  summary: Create a Square customer, place a Square order for them, then email a confirmation with SendGrid.
  description: >-
    A commerce workflow that creates a customer in Square (Block), places an
    order tied to a location for that customer, and emails them an order
    confirmation through SendGrid. Demonstrates chaining two Square commerce
    operations into a single customer-facing email via a communications provider.
  version: 1.0.0
sourceDescriptions:
  - name: blockApi
    url: https://raw.githubusercontent.com/api-evangelist/block/refs/heads/main/openapi/block-square-api-openapi.yaml
    type: openapi
  - name: sendgridApi
    url: https://raw.githubusercontent.com/api-evangelist/sendgrid/refs/heads/main/openapi/tsg_mail_v3.yaml
    type: openapi
workflows:
  - workflowId: square-customer-order-confirm
    summary: Create a Square customer, place an order, and email a SendGrid confirmation.
    description: >-
      Creates a Square (Block) customer, places an order for them at a location,
      then emails an order confirmation to the customer via SendGrid.
    inputs:
      type: object
      properties:
        givenName:
          type: string
        email:
          type: string
        locationId:
          type: string
        idempotencyKey:
          type: string
        itemName:
          type: string
    steps:
      - stepId: create-customer
        description: Create the customer in Square.
        operationId: $sourceDescriptions.blockApi.create-customer
        requestBody:
          contentType: application/json
          payload:
            given_name: $inputs.givenName
            email_address: $inputs.email
        successCriteria:
          - condition: $statusCode == 200
        outputs:
          customerId: $response.body#/customer/id
      - stepId: create-order
        description: Place a Square order for the customer at a location.
        operationId: $sourceDescriptions.blockApi.create-order
        requestBody:
          contentType: application/json
          payload:
            idempotency_key: $inputs.idempotencyKey
            order:
              location_id: $inputs.locationId
              customer_id: $steps.create-customer.outputs.customerId
              line_items:
                - name: $inputs.itemName
                  quantity: "1"
        successCriteria:
          - condition: $statusCode == 200
        outputs:
          orderId: $response.body#/order/id
      - stepId: email-confirmation
        description: Email the customer an order confirmation via SendGrid.
        operationId: $sourceDescriptions.sendgridApi.SendMail
        requestBody:
          contentType: application/json
          payload:
            personalizations:
              - to:
                  - email: $inputs.email
                subject: Your order is confirmed
            from:
              email: [email protected]
            content:
              - type: text/plain
                value: Thanks for your order! We are getting it ready.
        successCriteria:
          - condition: $statusCode == 202
        outputs:
          emailStatus: $statusCode
    outputs:
      customerId: $steps.create-customer.outputs.customerId
      orderId: $steps.create-order.outputs.orderId
      emailStatus: $steps.email-confirmation.outputs.emailStatus