eLabNext automation supports webhooks that send notifications to Slack or Microsoft Teams when triggered by specific events. By configuring a webhook, users can define what information is sent and where, such as a specific channel or individual, enabling real-time alerts in their preferred workspace.
Slack Webhook Setup
Before Begining
To set up a Slack webhook, the user will need the correct permissions. Workspace owners and admins can set it up directly; other users may need to request access.
Required permissions:
- The user must be able to create and install an app in their Slack workspace.
- To check the user’s access, go to api.slack.com/apps and try to create a new app. If the user is unable to do so, contact the workspace owner or admin. The user can also access api.slack.com/apps through the web application by navigating to Apps, selecting Automations, and then selecting Slack Marketplace in the top right corner.
- If the user cannot install an app in their Slack workspace, contact the workspace owner or admin. The user can also create their own workspace by clicking the following link, https://slack.com/get-started?entry_point=help_center#/createnew, and can install their Slack app in the newly created workspace.
- The app must be able to enable Incoming Webhooks in the app configuration.
- After creating an app, enable the Incoming Webhooks feature within the app settings.
- Try to Add a New Webhook to the Workspace. If the user can do this, they have the necessary permissions. If they’re prompted to request admin approval, contact the workspace admin.
Important Limitations
- To send a webhook to a private Slack channel, the user setting up the webhook must be a member of that channel.
Setting Up a Webhook in Slack
-
Navigate to https://api.slack.com/messaging/webhooks and follow Steps 1–3.
Notes:
- In Step 1 (creating an app), remember: the name chosen will become the "user" or bot name that sends messages.
- In Step 3 (adding a webhook), the user can choose a channel or user to send the webhook to. After doing so, copy the generated Webhook URL.
Once the user has completed steps 1–3 (created an app, activated Incoming Webhooks, and added a webhook to a workspace), continue with the configuration in eLabNext.
Finishing the Slack Webhook Configuration in eLabNext
The user must have the correct permissions to complete these steps. Administrators have these permissions by default; other users should request access from an administrator.
- In eLabNext, navigate to the Configuration tab, select the Automations tab and create or open the automation the user would like to add a webhook to.
- Within the automation configuration page, add a new Webhook action.
- Under Webhook URL, paste the URL generated in Slack (step 3 during the previous steps).
- In the Webhook body, use the following template:
{ "text": "Hello World" }
5. Customize the message by replacing `Hello World` with the desired text and/or dynamic attributes. For example:
{ "text": "The sample {{sample.name}} was created at {{sample.createdDate}} by {{sample.creator}}." }
6. For more styling options, see the advanced formatting documentation on Slack's site: Slack Webhook Documentation
7. Save the webhook action and ensure it is enabled.
8. Create the appropriate conditions to trigger the automation.
Once triggered, the webhook message will appear in the Slack channel selected.
Microsoft Webhook Setup
Setting Up a Webhook in Teams
- Navigate to Creating incoming webhooks with Workflows for Microsoft Teams. and follow the steps listed there to set up a webhook to post to a chat or post to a channel.
- Once the user has reached the step where it displays a URL to copy, copy that URL.
Notes:
- Look for the webhook template Post to a chat when a webhook request is received. If the user does not see this template, contact the Teams IT admin.
Finishing the Microsoft Teams Webhook Configuration in eLabNext
The user must have the correct permissions to complete these steps. Administrators have these permissions by default; other users should request access from an administrator.
- In eLabNext, navigate to the Configuration tab, select the Automations tab and create or open the automation the user would like to add a webhook to.
- Within the automation configuration page, add a new Webhook action.
- Under Webhook URL, paste the URL generated in Microsoft Teams (step 2 during the previous steps).
- In the Webhook body, use the following template:
{
"type": "message",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"contentUrl":null,
"content": {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.4",
"body": [
{
"type": "TextBlock",
"text": "Here between the quotes, enter text and smart values",
"wrap": true
}
]
}
}
]
}
5. Customize the message sent to the chosen channel or chat by replacing the value between the quotations for the text attribute with the desired text and/or dynamic attributes. For example:
{ "text": "The sample {{sample.name}} was created at {{sample.createdDate}} by {{sample.creator}}." }
6. The above template is used to create an Adaptive Card JSON file when it is sent to Microsoft Teams. The user does not need to change anything in the above template to get a webhook to function other than what is mentioned in Step 5. For additional information on this template, refer to the following resource: Microsoft Teams Webhook Documentation
7. Save the webhook action and ensure it is enabled.
8. Create the appropriate conditions to trigger the automation.
Once triggered, the webhook message will appear in the Microsoft Teams channel or chat selected.