Swallow
  • YOUR FIRST MODEL
    • Setting up your first project
    • Manual setup of a new product
    • Excel Model Upload
    • Create your team
    • Essential concepts
      • Syntax
      • Steps
      • Collections
      • Try Model
      • Spotlight
  • PROCESS
    • Team Management
    • Governance & Collaboration
  • BUILD
    • Building with AI
    • Step builder
      • Understanding step types
      • Ordering step blocks
      • Placeholder mode
      • Up/Downloading models
      • Sharing your model
      • Running tests
    • Inputs
    • Enriching Raw Data
      • Transform Data
      • Enrich via API
      • Data Set
      • Collection
      • Custom Code
    • Setting Up Decisions
      • Exclusions
      • Excesses
      • Endorsements
      • Refer
    • Making Calculations
      • Factors
      • Calculation
    • Outputs
  • TEST
    • Creating New Tests
    • Running Tests
    • Editing Tests
    • Reading & Interpreting Tests
    • Impact Testing
  • DATA
    • Working with real-time data
    • Data Views
    • Data Quotas
    • Troubleshooting
    • API Webhooks
    • Data Downloads
  • ADMIN & SETTINGS
    • Project Management
    • Account Management
  • INTEGRATIONS
    • Introduction
    • Payments
      • Stripe
      • GoCardless
      • Adyen
    • Alerting
      • Slack
      • Zapier
    • Data
      • AWS S3
      • Google Sheets
    • Admin
      • Socotra
      • Guidewire
      • Hubspot
      • Salesforce
  • Developer API
    • Introduction
    • Authentication
    • Errors codes
    • Endpoints
      • /quotes
      • /projects
      • /tests
      • /process
Powered by GitBook
On this page
  • Quote Alerting Example (with Zapier)
  • 1. Catch a webhook when a new quote is emitted
  • 2. Run a script to transform the webhook
  • 3. Send a message to a Slack Channel
  1. INTEGRATIONS
  2. Alerting

Zapier

Swallow with Zapier to create automated alerts on quote creation.

PreviousSlackNextData

Last updated 4 months ago

Quote Alerting Example (with Zapier)

In this example, we are going to build an alert anytime a new quote is created. To create this workflow, we are using:

  1. Swallow's webhook when a new quote is emitted;

  2. Zapier as an automation tool, to catch, transform and send the data; and

  3. Slack as the "receiver" to alert your team anytime a new quote is created.

1. Catch a webhook when a new quote is emitted

Swallow automatically creates a quote when a billable period is over. The quote's payload gives you a detailed view of what has been quoted. The first action we need to perform is to catch this quote with a webhook:

  1. In Zapier, create a new Zap;

  2. Use the Webhooks by Zapier as the trigger of this Zap;

  3. Select the Catch Raw Hook event trigger;

  4. Copy the Zapier Webhook URL and paste it in Swallow (navigate to Settings then Webhooks > Add a webhook)

  5. Catch your first webhook when a quote is emitted (whenever you assign an add-on or a subscription).

2. Run a script to transform the webhook

In Zapier, create a second action by clicking the + icon. This new event action is used to format the webhook with a breakdown of fields that can be used in a message.

  1. Select Code by Zapier as a new Event Action;

  2. Click on Javascript as the event code language to run;

  3. Create a field called payload. The value of this field is the full Raw body of your quote object received);

  4. Run the script (code snippet below) in the Code section;

  5. Test the action. If valid, it returns a breakdown of fields.

var obj = JSON.parse(inputData.payload);

if(obj.object_type == "quote"){
  return obj
}

3. Send a message to a Slack Channel

Once you catch the breakdown of fields returned by the quote payload, you can easily use them to create a Slack text message.

In Zapier, create a third action by clicking the + icon. This new event action is used to send a message to Slack by using the fields of the quote payload.

  1. Select Slack as a new app action;

  2. Select the Send Channel Message action;

  3. Choose the targeted Slack Account;

  4. Choose the targeted Slack Channel; and

  5. Create a message by using the fields returned by the payload.

By testing and validating the entire Zap, a Slack message is sent anytime a new quote is emitted by Swallow. You can use the same message example as detailed below: