Build a slack webhook

Create a Slack Automation

  1. Navigate to Automations in Slack
  1. Click “New Workflow”
  2. Rename the workflow to “Schematic Webhook”
  3. Start the workflow “From a webhook” and click Continue in the modal (we’ll set up variables later)
  4. Copy the Web request URL

Create a Schematic endpoint

  1. Navigate to Integrations in Schematic
  2. Click Webhooks and Create an endpoint
  3. In the modal, name the endpoint “Slack Alerts”
  4. Use the “Web request URL” from Slack in the URL field
  5. Select the following triggers: company.created, company.deleted

Company webhooks will look like this:

{
"action": "company.deleted",
"account_id": "acct_xxxxxxx",
"environment_id": "env_xxxxxxx",
"body": {
"created_at": "2024-07-31T19:20:01.223757Z",
"environment_id": "",
"id": "comp_xxxxxxx",
"last_seen_at": null,
"logo_url": null,
"name": "cus_xxxxxxx",
"updated_at": "2024-07-31T19:20:01.223757Z",
"add_ons": null,
"entity_traits": [],
"keys": [],
"plan": null,
"plans": null,
"traits": {},
"user_count": 0
},
"object_type": "company"
}

Configure the Slack Automation

  1. Navigate to the Schematic Webhook workflow in Slack
  2. Click into the Webhook step to configure it, and click “Set up variables”
  3. Type action into the key field and select the Text data type
  1. Once your webhook is configured, set up a new channel in Slack named “test-slack-alerts” (or anything you like!)
  2. In your workflow, select Messages > Send a message to a channel
  3. Insert the action variable and add a message.
{} action was triggered in Schematic.

Test your webhook

Now that our Slack Automation is set up, we can test triggering webhooks from Schematic.

  1. Navigate to the Company tab in Schematic
  2. Click Create and fill in a name and a key for the test company
  3. You should see a new alert in Slack

You can also try deleting the company to trigger a company.delete.

Slack is limited to parsing top level fields (it cannot access nested fields, unfortunately)

Next steps

Nearly every operation you can make on objects in Schematic will trigger a webhook, so you can support a variety of scenarios, such as:

  • Keeping CRM records in sync
  • Updating Billing records
  • Alerting internal stakeholders of customer changes via Slack or email
  • …and more

We will be expanding support for other webhook scenarios in the future, including reaching limits.