Preview: SendMock has no stable release yet. These docs follow develop.
SendMock
Recipes

Slack and push

Point your app's Slack webhook and push notification calls at the HTTP Catcher, so nothing reaches real people, and see each one previewed.

Try it in the demo.

The situation: your app posts to Slack when an order fails and sends push notifications when it ships. During development these reach the real team channel and real phones.

You need: the settings where your app keeps its Slack webhook URL and push API base URL.

Steps

  1. In HTTP Catcher, press New bin. Name slack, preset Slack incoming webhook, Add bin.
  2. Copy the catch URL, http://127.0.0.1:8025/catch/slack, into your app's Slack webhook setting.
  3. Press New bin again: name push, preset Firebase Cloud Messaging v1 (or Expo push, OneSignal). Set your app's FCM base URL to http://127.0.0.1:8025/catch/push.
  4. Trigger an alert and a push in your app.

In your code

A test that fails an order and checks your app's Slack alert reached the slack bin, not the team.

The examples call SendMock's REST API with each language's usual HTTP client and test framework. JavaScript, Go, Java, Rust, Ruby and C# use the small call helper shown under Test helper on their page in Connect your app.

# In your app: fail order 42; your app posts to http://127.0.0.1:8025/catch/slack

alert=$(sendmock http wait --bin slack --method POST --timeout 10s --json)

jq -e '.bin_name == "slack"' <<<"$alert" >/dev/null
jq -e '.response_status == 200' <<<"$alert" >/dev/null

What you should see

Each request under its bin. Preview shows the Slack message as Slack draws it and the push as a phone notification card; Response shows SendMock answered as Slack and FCM do (200 ok, a message name), so your app carried on.

Try it in the demo

  1. Open HTTP Catcher and press New bin. Name it alerts, pick Slack incoming webhook, press Add bin. The catch URL shows http://127.0.0.1:8025/catch/alerts.
  2. Click the slack bin and its first request: Preview shows a Slack message.

Next

On this page