Alerting
This API is experimental and subject to change. To enable experimental features, run the daemon with --v8-experimental-features.
M yeet.alert
alert(...args: any[]): Promise<any>
Dispatches an alert event to the yeet platform and returns a Promise that settles when the platform responds.
| Parameter | Type | Description |
|---|---|---|
...args | any[] | Any JSON-serializable values, forwarded to the platform as-is. |
Returns a Promise that resolves or rejects with the JSON payload returned by the platform.
Currently, yeet.alert supports sending Slack messages. Sending a Slack alert requires connecting your Slack workspace — set up the OAuth integration at yeet.cx/settings before use.
Pass an object with method: "slack", a channel, and a text fallback. You can also include a blocks array for richer formatting using Slack Block Kit.
const result = await yeet.alert({
method: "slack",
channel: "#alerts",
text: "Container down",
blocks: [
{
type: "header",
text: { type: "plain_text", text: "Container down" },
},
{
type: "section",
fields: [
{ type: "mrkdwn", text: "*Container:*\nnginx" },
{ type: "mrkdwn", text: "*Status:*\nexited" },
],
},
],
});
console.log("alert sent", result);
yeet.alert is only registered when experimental features are enabled. Check before calling if your script needs to run in both modes:
if (typeof yeet.alert !== "undefined") {
await yeet.alert("my-event");
}
Promise lifecycle
The platform responds with an HTTP status that determines how the promise settles:
| Status | Outcome |
|---|---|
200 OK | Resolves immediately with the response payload. |
202 Accepted | Parked — the platform will settle it later out-of-band. |
429 Too Many Requests | Rejects with RateLimited. Not retried. |
Other 4xx / 5xx | Rejects with the response payload (up to 3 retries on auth and server errors). |
Failure modes
The promise rejects if:
- No access token is available (not logged in).
- All retry attempts are exhausted on a server or auth error.
- The platform returns
429(rate limited). - The platform returns a non-success status after retries.