Skip to main content

Slack Integration

Configure Slack notifications to receive job failure alerts directly in your Slack channels. Slack integration uses the Slack Bot API for reliable, formatted message delivery.


Prerequisites

Before configuring Slack notifications:

  1. Slack Workspace Access: You need admin access or ability to install apps

  2. Slack App Creation Permission: Ability to create Slack apps

  3. Job Queue Admin Setup Complete: Privacy acknowledged and extension enabled


Creating a Slack App

Step 1: Create New Slack App

  1. Go to api.slack.com/apps

  2. Click Create an App

  3. Choose From scratch

  4. Enter App Name: "JQA Notifications" (or your preferred name)

  5. Select your Workspace

  6. Click Create App

image-20260208-183520.png

Step 2: Configure Bot Token Scopes

  1. In the left sidebar, click OAuth & Permissions

  2. Scroll to Scopes section

  3. Under Bot Token Scopes, click Add an OAuth Scope

  4. Add the following scope:

ScopePurpose
chat:writePost messages to channels

image-20260208-183707.png

Step 3: Install App to Workspace

  1. Scroll to top of OAuth & Permissions page

  2. Click Install to Workspace

  3. Review permissions and click Allow

  4. Copy the Bot User OAuth Token - you'll need this for Job Queue Admin

image-20260208-183911.png

Token Format: xoxb-1234567890-1234567890123-AbCdEfGhIjKlMnOpQrStUvWx

Important: Keep this token secure - it grants posting access to your workspace.

Step 4: Invite Bot to Channel

  1. Open Slack and go to the channel where you want notifications

  2. Type /invite @JQA Notifications (or your app name)

  3. Or click the channel name > Integrations > Add apps

image-20260208-184032.png

Step 5: Get Channel ID

  1. Right-click on the channel name in Slack

  2. Select View channel details (or click channel name)

  3. Scroll to bottom and copy the Channel ID

image-20260208-184148.png

Channel ID Format: C01ABCDEFGH (starts with C for public, G for private)


Creating a Slack Channel in Job Queue Admin

Step 1: Open Notification Channels

  1. Search for Notification Channels

  2. Or from Job Queue Admin Setup: Actions > Navigate > Notification Channels

Step 2: Create New Channel

  1. Click New to create a new channel

  2. Fill in the required fields:

FieldValue
CodeUnique identifier (e.g., SLACK-OPS)
Channel TypeSlack
DescriptionDescriptive name (e.g., "IT Operations Slack")
Slack Channel IDChannel ID from Step 5 above
Slack Bot TokenBot token from Step 3 above
EnabledYes

image-20260208-184343.png

Step 3: Save and Test

  1. Click OK to save the channel

  2. Use Send Test Notification action to verify delivery

  3. Check your Slack channel for the test message


Slack Channel Fields

Identification

FieldDescriptionRequired
CodeUnique channel identifierYes
Channel TypeMust be "Slack"Yes
DescriptionHuman-readable nameNo
EnabledActive/inactive toggleYes

Slack Settings

FieldDescriptionRequired
Slack Channel IDTarget channel ID (C... or G...)Yes
Slack Bot TokenBot User OAuth Token (xoxb-...)Yes

Slack Channel ID Format:

  • Public channels: C01ABCDEFGH

  • Private channels: G01ABCDEFGH

  • Get from channel details in Slack

Slack Bot Token Format:

  • Starts with xoxb-

  • From Slack App OAuth page


Slack Message Format

Block Kit Structure

Slack notifications use Block Kit for rich formatting:

{ "channel": "{Channel ID}", "blocks": [ { "type": "header", "text": { "type": "plain_text", "text": "Job Queue Failure" } }, { "type": "section", "fields": [ {"type": "mrkdwn", "text": "*Job:*\n{Description}"}, {"type": "mrkdwn", "text": "*Company:*\n{Company}"}, {"type": "mrkdwn", "text": "*Error:*\n{Error Message}"}, {"type": "mrkdwn", "text": "*Time:*\n{Timestamp}"} ] }, { "type": "actions", "elements": [ { "type": "button", "text": {"type": "plain_text", "text": "Restart Now"}, "url": "{Signed Action URL}" }, { "type": "button", "text": {"type": "plain_text", "text": "Put On Hold"}, "url": "{Signed Action URL}" }, { "type": "button", "text": {"type": "plain_text", "text": "View in BC"}, "url": "{Deep Link}" } ] } ] }

Example Slack Message

image-20260208-184556.png

The message includes:

  • Header: "Job Queue Failure" with alert emoji

  • Job Details: Description, error, timestamp, company in fields

  • Action Buttons: Restart Now, Put On Hold, and View in BC


Interactive Action Buttons

Slack notifications include interactive buttons that let you take action directly from the notification:

Available Actions

ButtonActionDescription
Restart NowRestarts the jobSets job status to Ready and triggers the scheduler
Put On HoldPuts job on holdPrevents automatic restart, requires manual action
View in BCOpens BCDeep link to the Job Queue Entry card

How It Works

  1. Click an action button in the Slack notification

  2. A browser window opens briefly showing the action result

  3. The job status is updated in Business Central

  4. You can close the browser tab and return to Slack

Button Security

  • Action buttons use signed URLs that expire after 7 days

  • Each notification has unique action links

  • Links cannot be forged or tampered with

  • After expiry, you'll see a friendly error asking you to use a more recent notification


Testing Slack Channel

Using Send Test Notification

  1. Open the Slack Channel card

  2. Click Send Test Notification in the action bar

  3. A test notification is sent immediately

  4. Check your Slack channel for the test message

Verifying Delivery

  1. Check the target Slack channel

  2. Message should appear within seconds

  3. Review Notification Log for send status

Troubleshooting Test Failures

SymptomPossible CauseSolution
No message in SlackBot not in channelInvite bot to channel
channel_not_foundInvalid Channel IDVerify Channel ID
invalid_authInvalid Bot TokenVerify token, regenerate if needed
not_in_channelBot not invitedInvite bot with /invite
Timeout errorNetwork connectivityCheck firewall rules

Bot Token Management

Regenerating Token

If your token is compromised:

  1. Go to api.slack.com/apps

  2. Select your JQA app

  3. Go to OAuth & Permissions

  4. Click Reinstall to Workspace

  5. Copy new token

  6. Update Slack Bot Token in all channels using this app

Token Security

  • Store securely: Token is stored in BC database

  • Limit access: Only admins should access channel settings

  • Rotate periodically: Consider annual token rotation

  • Monitor usage: Check Slack app analytics for unusual activity


Multiple Slack Channels

You can create multiple Slack channels for different purposes:

Example: Routing by Team

Channel CodeSlack ChannelDescription
SLACK-SALES#sales-alertsSales integration failures
SLACK-OPS#it-operationsGeneral job failures
SLACK-CRITICAL#critical-alertsCritical system failures

Shared Bot Token

You can use the same Slack App (and bot token) for multiple notification channels:

  1. Create one Slack App with chat:write scope

  2. Invite bot to all target channels

  3. Use same bot token with different Channel IDs in Job Queue Admin


Best Practices

Slack App Setup

  1. Name clearly: Include "BC" or "JQA" in app name

  2. Use workspace icon: Add recognizable app icon

  3. Minimal scopes: Only request chat:write

Channel Selection

  1. Use dedicated alert channels: Don't spam general channels

  2. Consider channel visibility: Public vs. private

  3. Set up channel notifications: Configure Slack notification preferences

Trigger Configuration

  1. Start with Error only: Reduce noise initially

  2. Add Cooldown for critical jobs: Important awareness


Security Considerations

Bot Token Protection

  • Treat as password: Bot token grants posting access

  • Don't commit to source control: Keep in BC config only

  • Regenerate if exposed: Reinstall app to get new token

Channel Access

  • Private channels: Bot must be explicitly invited

  • Channel ID visibility: ID alone doesn't grant access

  • App permissions: Slack admins can revoke app access

Message Content

  • Error messages visible: Consider what errors contain

  • Deep links require BC access: URL alone doesn't grant access

  • Company name included: Multi-company considerations


Next Steps: Configure Auto-Restart Rules to automatically recover from transient errors, or set up Job Configurations for channel routing.