notifications-dsl-functions
Notifications DSL Functions
Notifications use two DSL shapes:
- a notification algorithm that searches notification candidates,
- a delivery config that sends matched candidates to your webhook.
Notification algorithm functions
| Function | Meaning | Example |
|---|---|---|
.search() | Starts candidate retrieval | mbd.search() |
.index(name) | Selects a notification index | .index("dex-notifications") |
.include() | Hydrates notification rows | .include() |
.inAppUsers(field) | Joins candidates to account-owned users or wallets | .inAppUsers("wallet_address") |
.notNull(field) | Requires a field before delivery | .notNull("user_id") |
.sortBy(field, direction) | Orders candidates | .sortBy("timestamp", "desc") |
.size(n) | Caps candidates returned | .size(50) |
.execute() | Runs the algorithm query | .execute() |
import { StudioV1 } from "algo-dsl";
export default async function notificationAlgo({ apiKey }) {
const mbd = new StudioV1({ apiKey });
return mbd
.search()
.index("dex-notifications")
.include()
.inAppUsers("wallet_address")
.notNull("user_id")
.sortBy("timestamp", "desc")
.size(50)
.execute();
}Delivery config functions
| Function | Meaning | Example |
|---|---|---|
notification(name) | Creates a named notification config | notification("wallet-alerts") |
.algos(ids) | Selects deployed notification algorithm ids | .algos([125]) |
.webhook(url, options) | Sends matched candidates to your endpoint | .webhook("https://your-app.com/webhooks/embed-notifications") |
.cooldown({ hours, key }) | Prevents repeated delivery for the same key | .cooldown({ hours: 4, key: "user_id" }) |
.priorityFilter(value) | Limits delivery to priority classes | .priorityFilter("P0,P1") |
.dailyBudget(n) | Caps daily deliveries | .dailyBudget(5000) |
import { notification } from "algo-dsl";
export default notification("wallet-alerts")
.algos([125])
.webhook("https://your-app.com/webhooks/embed-notifications", {
authBearer: process.env.EMBED_WEBHOOK_TOKEN
})
.cooldown({ hours: 4, key: "user_id" })
.priorityFilter("P0,P1")
.dailyBudget(5000);Ingestion vs delivery
Ingestion prepares account-owned users or wallets. Delivery sends matched candidates.
Use .inAppUsers(...) in the algorithm when delivery should only target ingested users or wallets. Use .webhook(...), .cooldown(...), .priorityFilter(...), and .dailyBudget(...) in the delivery config.

