Skip to content

Slack Notifications

Scripts send Slack messages via the injected $notifications object, using named webhooks you configure in Admin Settings. The webhookName you pass must match the name of a saved webhook.

1. Create a Slack Incoming Webhook

  1. Go to api.slack.com/apps and click Create New App
  2. Choose From scratch, give it a name (e.g. "ApiMeld"), and select your workspace
  3. In the left sidebar, click Incoming Webhooks
  4. Toggle Activate Incoming Webhooks to On
  5. Click Add New Webhook to Workspace
  6. Select the channel you want ApiMeld to post to
  7. Copy the webhook URL — it looks like:
    https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX

Channel per environment

Consider separate webhooks for different channels — e.g. #apimeld-prod for failures and #apimeld-dev for dev runs. Each gets its own name in ApiMeld.

2. Add the webhook to ApiMeld

  1. Go to Admin → Settings → Notifications
  2. Under Slack Webhooks, click Add
  3. Enter a name (e.g. "Ops Channel") and paste the webhook URL
  4. Click Save

The name you enter here is what you pass as webhookName in your scripts.

Sending from a script

LanguageOne-liner
PowerShell$notifications.SendSlack('Ops Channel', 'Task complete')
JavaScript / TypeScriptnotifications.sendSlack('Ops Channel', 'Task complete')
Pythonnotifications.send_slack('Ops Channel', 'Task complete')
Bashnotify_slack "Ops Channel" "Task complete"
C#Notifications.SendSlack("Ops Channel", "Task complete");

Larger example (PowerShell)

powershell
try {
    $result = Invoke-RestMethod -Uri $datasources.OrdersApi.GetOrders.Url -Headers $AuthHeaders
    $count  = $result.Count
    $notifications.SendSlack('Ops Channel', "Nightly sync complete — $count orders processed.")
} catch {
    $notifications.SendSlack('Ops Channel', "Nightly sync FAILED: $_")
}

Parameters

ParameterDescription
webhookNameThe name of the webhook as saved in Admin → Settings → Notifications
messagePlain text message to post

Testing the webhook

After saving, click Test next to the webhook in Admin → Settings → Notifications to send a test message to the channel.