SARAH

Make and Zapier

Guide to integrate Sarah with Make (Integromat) and Zapier to automate processes

Last updated: 2025-01-26

Sarah integrates seamlessly with automation platforms like Make (formerly Integromat) and Zapier to connect your management system with thousands of applications.

Initial Configuration

1. Get Integration Key

  1. Log in to Sarah
  2. Go to Settings > Integrations
  3. Copy your Integration Key
  4. Save it securely (don't share it publicly)

2. Configure Webhook in Make/Zapier

For Make (Integromat)

  1. Create a new scenario
  2. Add a Webhooks > Custom webhook module
  3. Configure:
    • Method: POST
    • URL: https://sarah.ar/api/integration/in
    • Headers:
      Authorization: Bearer <your-integration-key>
      Content-Type: application/json

For Zapier

  1. Create a new Zap
  2. Choose Webhooks by Zapier as trigger or action
  3. Configure:
    • URL: https://sarah.ar/api/integration/in
    • Method: POST
    • Headers:
      Authorization: Bearer <your-integration-key>
      Content-Type: application/json

Send Events to Sarah (Inbound)

You can send events from Make/Zapier to Sarah to create or update data.

Example: Update Product Stock

Request structure:

json
{
  "event": "product.upserted",
  "data": {
    "product": {
      "id": 123,
      "sku": "ABC-001",
      "name": "Updated Product",
      "stock": 50,
      "base_price": 1500.00
    }
  }
}

Required headers:

http
Authorization: Bearer <your-integration-key>
Content-Type: application/json
x-idempotency-key: product.upserted:123
x-sent-at: 2025-01-26T12:34:56.789Z

Example in Make

  1. Trigger: Choose the event that will trigger the webhook (e.g., new order in Shopify)
  2. Action: Add HTTP > Make a Request module
  3. Configuration:
    • URL: https://sarah.ar/api/integration/in
    • Method: POST
    • Headers:
      json
      {
        "Authorization": "Bearer {{your-integration-key}}",
        "Content-Type": "application/json",
        "x-idempotency-key": "product.upserted:{{product.id}}",
        "x-sent-at": "{{now}}"
      }
    • Body:
      json
      {
        "event": "product.upserted",
        "data": {
          "product": {
            "id": "{{product.id}}",
            "sku": "{{product.sku}}",
            "name": "{{product.name}}",
            "stock": "{{product.stock}}",
            "base_price": "{{product.price}}"
          }
        }
      }

Example in Zapier

  1. Trigger: Choose your trigger (e.g., new record in Google Sheets)
  2. Action: Webhooks by Zapier > POST
  3. Configuration:
    • URL: https://sarah.ar/api/integration/in
    • Method: POST
    • Headers:
      Authorization: Bearer <your-integration-key>
      Content-Type: application/json
    • Data: Map trigger fields to Sarah format

Receive Events from Sarah (Outbound)

To receive events from Sarah in Make/Zapier, you need to configure a webhook that Sarah can call.

Configuration in Make

  1. Create a scenario
  2. Add Webhooks > Custom webhook module
  3. Copy the generated Webhook URL
  4. Configure this URL in Sarah (requires environment variable configuration)

Configuration in Zapier

  1. Create a new Zap
  2. Choose Webhooks by Zapier > Catch Hook as trigger
  3. Copy the generated Webhook URL
  4. Configure this URL in Sarah

Available Events

Sarah can send the following events:

  • sales.created - New sale created
  • sales.paid - Sale paid
  • sales.cancelled - Sale canceled
  • invoice.issued - Fiscal receipt issued
  • movement.created - Inventory movement
  • product.upserted - Product created/updated
  • product.stock_updated - Stock updated

Example: Notify in Slack when a sale is created

In Make:

  1. Trigger: Custom webhook (receives events from Sarah)
  2. Filter: Only process if event = "sales.created"
  3. Action: Slack > Create a Message
  4. Configuration:
    json
    {
      "channel": "#sales",
      "text": "New sale: {{data.sale.total}} - Customer: {{data.sale.customer_id}}"
    }

In Zapier:

  1. Trigger: Webhooks by Zapier > Catch Hook
  2. Filter: Only if event equals sales.created
  3. Action: Slack > Send Channel Message
  4. Map data.sale fields to Slack message

Common Use Cases

1. Sync Products from Shopify

Flow:

  1. New product in Shopify → Make/Zapier
  2. Make/Zapier → Sarah (product.upserted)
  3. Product available in Sarah

2. Update Inventory in Google Sheets

Flow:

  1. Sarah → Make/Zapier (product.stock_updated)
  2. Make/Zapier → Google Sheets (update row)

3. Send Email when Invoice is Issued

Flow:

  1. Sarah → Make/Zapier (invoice.issued)
  2. Make/Zapier → Email (Gmail, SendGrid, etc.)
  3. Customer receives invoice by email

4. Create Order in Sarah from WooCommerce

Flow:

  1. New order in WooCommerce → Make/Zapier
  2. Make/Zapier → Sarah (sales.created)
  3. Order created in Sarah

5. Notify in Discord when Stock is Low

Flow:

  1. Sarah → Make/Zapier (product.stock_updated)
  2. Make/Zapier → Filter (if current_stock < 10)
  3. Make/Zapier → Discord (send message)

Security

For greater security, you can configure HMAC signatures:

  1. In Sarah: Configure MAKER_WH_HMAC_SECRET (environment variable)
  2. In Make/Zapier: Validate x-signature header

Validation example in Make:

  1. Add Tools > Set variable module to capture x-signature
  2. Calculate HMAC SHA-256 of raw body
  3. Compare with received header
  4. If they don't match, reject request

Replay Protection

Sarah includes x-sent-at header with ISO timestamp. Validate that event is not older than 5 minutes:

javascript
const sentAt = new Date(request.headers['x-sent-at']);
const ageMs = Date.now() - sentAt.getTime();
if (Math.abs(ageMs) > 5 * 60 * 1000) {
  // Reject event
}

Idempotency

Use x-idempotency-key header to avoid processing the same event multiple times:

  1. Store processed keys
  2. If you receive a duplicate key, ignore the event
  3. Clean old keys periodically

Troubleshooting

Error: "Missing bearer"

  • Verify Authorization header is configured correctly
  • Ensure you include Bearer before the key

Error: "Invalid integration key"

  • Verify Integration Key is correct
  • Regenerate key from Settings > Integrations if necessary

Events don't arrive at Make/Zapier

  • Verify MAKER_WH_URL is configured in Sarah
  • Verify webhook URL is publicly accessible
  • Review Sarah logs for sending errors

Duplicate events

  • Implement idempotency using x-idempotency-key
  • Store processed keys and verify before processing

Additional Resources

Support

If you need help with integration:

  1. Review Make/Zapier logs for errors
  2. Verify header and body configuration
  3. Contact Sarah support with error details