This quick tutorial shows how to send notifications from Wordbee Translator into a Slack channel. For example, this permits pushing Slack notifications for newly assigned jobs or orders into a Slack channel.
Two steps are required to get it working: First, you need to configure Slack account and create a so-called “incoming web hook URL”. Second, you need to configure Wordbee Translator to trigger that URL with the events you want to show up in Slack. For that we use Wordbee Translator web hooks.
Configure Slack
If you have not yet done so please configure your Slack account. Objective is to create an Incoming Webhook URL to then configure Wordbee Translator.
Configure Wordbee Translator
We will now setup “web hooks” in your Wordbee Translator platform. A web hook is nothing more than a URL that Wordbee calls when an event such as a job status changes. The URL that Wordbee will call is the exact URL that you created when configuring Slack.
Login as administrator to your Wordbee Translator Platform.
Click the Settings top navigation link and then Developer API Webhooks (this link is at the bottom of the Settings page):
Example: Notify new or not-started jobs in Slack
Create a web hook
Click the Edit link in the page above. Then populate all fields such as in the following:
Properties to populate are:
Webhook: Choose “Codyt job - Status change to Not started”. This will notify new jobs.
URL: Paste the Incoming Webhook URL that you created in Slack
HTTP method: Select POST
Content type: Select application/json
HTTP body: This is where you design the content that will show up in Slack
Define Slack notification content
The HTTP body is a JSON document and composed of elements inside the “blocks” array.
The structure must comply with the Slack specifications, see https://api.slack.com/block-kit/building
From the screenshot above, you see that you need to insert Wordbee “placeholders” such as {{JobReference}} or {{CompanyName}} to show all the job details you want to see in Slack.
Hint: At the bottom of the page there is link to view all available placeholders.
A simple payload is shown below. It notifies a job with the job reference and the assigned worker:
{ "blocks": [ { "type": "header", "text": { "type": "plain_text", "text": "New job: {{JobReference}}" } }, { "type": "section", "text": { "type": "plain_text", "text": "{{CompanyName}} - {{FirstName}} {{LastName}}" } } ] }
Test
Select a Codyt job and change its status to “Not started”. Alternatively, create a new Codyt job and assign it to someone so that its status is Not Started.
Note: If you want to notify creation of inactive jobs, you would configure the respective web hook in the same manner as above.
Within a few seconds you should see a message pop up in your Slack channel.
If nothing shows up, it may be that the web hook URL or the Slack configuration is not correct.
Hover the “Settings” top navigation link and select “Current activity” from the drop down menu. This lets you see which web hooks have been triggered and which ones were rejected by Slack.
Missing features
The following features may be missing in this implementation
Missing features:
At this point the URL is not an available placeholder. Therefore you cannot just yet include the job URL with the Slack notification. This has to be added.
You may miss some web hook types to notify other types of events. Let us know what you need!