# Build reliable trading alerts with MadeOnSol data

Build an internal trading or alert bot with filtered events, durable processing, duplicate suppression and bounded notification retries.

Access: Pro and above for standard streaming and webhooks; events vary by plan

[Compare plans and subscribe](https://madeonsol.com/pricing#pricing)

Author: MadeOnSol

Updated: 2026-11-17

## Integration choice

Separate event ingestion, rule evaluation and notification delivery. Persist the event before acknowledging a webhook, and use a durable outbox for alerts. A market-data event is an input to your rule, not an instruction to place a trade.

## Before you start

- A backend, durable queue or database, and a notification destination you control.
- An explicit rule definition and an event-specific identity from the documented payload.

## Implementation steps

1. Choose one signal and delivery path first: a supported webhook for event-triggered work, or a stream for a continuously running consumer. Verify the event is available to your tier.
2. For webhooks, verify the signature against the original body bytes. Validate the payload and durably enqueue it before returning a successful acknowledgement.
3. For WebSocket events, process in order and advance the replay checkpoint only after successful handling. Deduplicate ingestion separately from business actions.
4. Evaluate a deterministic rule and write an outbox entry with a unique identity derived from event, rule version and destination.
5. Deliver from a worker with bounded retries and destination-specific rate limits. Track pending, delivered and failed notifications independently from the stream connection.

## Keep ingestion independent of notification delivery

A slow chat or email provider should not block the event consumer. Store incoming verified events and process them asynchronously. Keep the original identity and the rule version so a retried job can be understood later.

Acknowledge a webhook only after durable acceptance. If your process crashes after returning success but before an in-memory task runs, the task can be lost. Durable storage and a worker restart test address that failure mode.

## Deduplicate the action you actually send

The same event can match several stream subscriptions or rules. Delivery-level deduplication alone does not decide whether two alerts are intended. Define an action key with event identity, rule version and destination, and enforce uniqueness in storage.

A worker can crash after a provider accepts a message but before the local record is marked delivered. Use provider idempotency keys if supported; otherwise document that this boundary can produce a duplicate. Do not promise exactly-once external delivery from an in-memory Set.

## Keep signals, execution and licensing separate

Use supported filters to reduce irrelevant events, then evaluate your own rule against the payload. Avoid polling every token just to discover a signal already available through an eligible push channel. Do not assume every channel supports the same filters.

This guide covers market-data ingestion and alerts, not a trade-execution strategy or guarantee. Automated execution needs a separate system for permissions, signing and execution risk. A customer-facing bot also needs display rights appropriate to its audience under the current terms.

## Build a durable action identity (standalone JavaScript)

~~~javascript
// Application action identity; persist it under a UNIQUE constraint.
// Select sourceEventId from the documented identity of your chosen event.
function alertActionKey({ chain, sourceEventId, ruleVersion, destination }) {
  const fields = [chain, sourceEventId, ruleVersion, destination];
  if (fields.some(x => typeof x !== "string" || x.length === 0)) throw new Error("Missing action identity");
  // JSON avoids delimiter collisions between identifiers.
  return JSON.stringify(fields);
}
console.log(alertActionKey({ chain: "solana", sourceEventId: "example-event-1",
  ruleVersion: "large-buy-v2", destination: "internal-alert-room" }));
// In one DB transaction: record accepted event + unique outbox action.
// A worker delivers the action. Pass a provider idempotency key if supported.
// This function alone is not a queue and does not ensure exactly-once delivery.
~~~

## Common mistakes and fixes

- Return success before writing the event durably. Fix: Write first; acknowledgement means your system accepted responsibility for processing.

- Send alerts directly inside a stream message callback. Fix: Use a durable outbox so provider latency does not block ingestion.

- Use the event ID as the only alert key. Fix: Include rule version and destination when those distinguish intended actions.

## Verify your integration

Replay the same input twice, restart after queue insertion, fail the notification provider and change a rule version. Confirm no input disappears, failures remain inspectable and duplicate prevention uses the intended event and action identities. Test altered webhook bytes are rejected.

## Production checklist

- Webhook tampering rejected before queue insertion.
- Worker restarts preserve accepted inputs.
- External provider failures have bounded retries and an inspectable failure queue.
- Public display rights checked for the bot’s audience.

## Frequently asked questions

### Can I guarantee exactly one Telegram or email message?

Only if the complete delivery path supports that guarantee. An external provider may accept a message before your worker can record success; design for this ambiguity.

### Are these examples a complete trading bot?

No. They are ingestion and notification building blocks. Trade execution and signing require their own integration and controls.

## Continue building

- [Process webhook retries without duplicate effects](https://madeonsol.com/docs/webhooks)
- [Recover a WebSocket feed after a disconnect](https://madeonsol.com/docs/websocket)
- [Build reliable MadeOnSol WebSocket recovery](https://madeonsol.com/docs/realtime-reliability)

## Match your plan to your workload

Compare capacity, channel access and display rights before launching.

[Compare plans and subscribe](https://madeonsol.com/pricing#pricing)

## Related reference

- [Webhook setup](https://madeonsol.com/api-docs#webhooks)
- [Webhook payloads](https://madeonsol.com/api-docs#webhook-payload)
- [Stream subscription builder](https://madeonsol.com/api-docs#stream-config)
- [Terms and display rights](https://madeonsol.com/terms)

[Canonical guide](https://madeonsol.com/docs/alert-bots)
