Skip to Content

How do I ingest events into Slashbin?

If your source has an API but no usable webhook, your own code can send each event to your Slashbin data stream. The Slashbin CLI scaffolds that ingest service: it signs the raw request body with your project’s key and retries failed sends.

When to use ingest

Use ingest when the source is API-only: you poll it, or your own system produces the events. If the source can send webhooks, point it at your data stream and build a receiver instead; see How do I build a webhook receiver?. For QuickBooks, see QuickBooks webhooks for non-developers.

Slashbin receives events. It does not send webhooks on behalf of your customers.

Quick start

Scaffold an ingest service with the Slashbin CLI:

slashbin init ingest <dir>

Two options help while you set up:

  • --dry-run prints the signed request, with a placeholder in place of the signature, and sends nothing.
  • --ingest-url <url> sets the ingest gateway base URL.

Set your signing key in the environment before you run the service:

export SLASHBIN_INGEST_SIGNING_KEY=<your project's signing key>

The key is read when the service runs and is never written to the scaffolded files.

Then create a data stream in the console, add a destination, and send a test event. The Getting Started walkthrough covers those steps.

Sign the request

Slashbin checks the signature on each event you send. The signature settings come from your project’s configuration in the Console:

  • Header name: the signature header your project is configured with
  • Encoding: hex or base64, as configured
  • Prefix: the prefix your project is configured with, if any

Copy these values from the Console into your ingest service. This guide names no default, because a signature built with a value that differs from your project’s configuration is rejected.

The digest is an HMAC of the raw request body. Sign the exact bytes you send, and do not re-serialize the JSON between signing and sending.

Retry

A send can fail for reasons that clear on their own. The scaffolded client follows these rules:

  • It sends the same bytes on every attempt, so the signature is the same each time.
  • It retries a network error, a timeout, a 429 or a 5xx response. When the response carries a Retry-After header, it waits that long.
  • It stops on any other 4xx response, such as 401 or 403. Retrying the same request cannot fix those; check your key and your project’s settings instead.
  • After the maximum number of attempts, it returns the failure to your code. Your code should move the event to a failure queue of its own and never drop it.

That failure queue is yours. It is not the Slashbin Dead Letter Queue, which holds events Slashbin accepted but could not deliver or transform; see What do I do with my webhook dead letter queue?.

What Slashbin does not promise

Ingest does not assign an event ID, and it does not deduplicate. It does not promise ordering, and it does not promise that an event arrives only once. If a send fails after Slashbin stored the event, a retry can store it again, so make whatever consumes the result handle the same event twice. Do I need a queue for webhooks? covers the queue on your side.

Once an event is in, the rest of the path is the same as for a webhook: replay a retained event after you fix a bug.

Need somewhere for the next project’s webhooks to land? Slashbin’s Free plan takes an account, not a card.

Start free

(opens in a new tab)