Integrating Slack Using API Call Notifications
This guide will help you create a Slack integration for platformOS using API Call Notifications.
Requirements
To follow this tutorial, you should be familiar with creating API Call Notifications. You also have to have access to a Slack workspace, have enabled webhooks, and created an incoming webhook. You will need the webhook URL for creating the API Call Notification.
Steps
Integrating Slack using API Call Notifications is a two-step process:
Step 1: Create API Call Notification
Your webhook URL looks similar to this: https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
.
Create an API Call Notification using your own webhook URL (replace placeholder):
---
name: { name of your file here }
format: http
request_headers: '{ "Content-Type": "application/json" }'
request_type: POST
to: { your webhook URL, e.g. https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX }
---
{
"text": "New Contact on Platform.OS.com!"
}
Note
You can customize your message in Slack quite a bit. Learn more about that on the page that provided you your webhook URL or on api.slack.com/incoming-webhooks
Step 2: Add API Call Notification to form
Add the following to the front matter on your form:
api_call_notifications:
- slack_sales_request
The front matter of the form we used in this example:
---
name: enquirer_signup
resource: User
fields:
email:
password:
api_call_notifications:
- slack_sales_request
---