Configure how you receive notifications for payment events. AnySpend supports email and Telegram delivery channels with per-event granularity.
Reading notification settings requires read permission. Updating settings and linking/unlinking Telegram requires admin permission.
Authentication
Authorization: Bearer asp_xxx
Base URL: https://platform-api.anyspend.com/api/v1
Endpoints
Get Notification Settings
Retrieve the current notification configuration for your account.
curl -X GET https://platform-api.anyspend.com/api/v1/notifications \
-H "Authorization: Bearer asp_xxx"
import { AnySpendClient } from "@b3dotfun/sdk/anyspend";
const client = new AnySpendClient({ apiKey: process.env.ANYSPEND_API_KEY! });
const settings = await client.notifications.get();
Response
{
"success": true,
"data": {
"email_enabled": true,
"email_address": "merchant@example.com",
"telegram_enabled": true,
"telegram_chat_id": "123456789",
"telegram_username": "@merchant",
"enabled_events": [
"payment.completed",
"payment.failed",
"checkout.completed"
],
"updated_at": "2026-02-20T14:30:00Z"
}
}
Update Notification Settings
Update notification preferences. All fields are optional — only the provided fields are changed.
Enable or disable email notifications.
Email address to receive notifications. Must be a valid email format.
Enable or disable Telegram notifications. Telegram must be linked first.
Array of event types to receive notifications for. Applies to both email and Telegram channels.
curl -X PATCH https://platform-api.anyspend.com/api/v1/notifications \
-H "Authorization: Bearer asp_xxx" \
-H "Content-Type: application/json" \
-d '{
"email_enabled": true,
"email_address": "payments@mycompany.com",
"telegram_enabled": true,
"enabled_events": ["payment.completed", "payment.failed"]
}'
const updated = await client.notifications.update({
email_enabled: true,
email_address: "payments@mycompany.com",
telegram_enabled: true,
enabled_events: ["payment.completed", "payment.failed"],
});
Response
{
"success": true,
"data": {
"email_enabled": true,
"email_address": "payments@mycompany.com",
"telegram_enabled": true,
"telegram_chat_id": "123456789",
"telegram_username": "@merchant",
"enabled_events": ["payment.completed", "payment.failed"],
"updated_at": "2026-02-27T12:00:00Z"
}
}
Link Telegram
POST /notifications/telegram/link
Generate a Telegram bot link URL. Opening this link starts a conversation with the AnySpend notification bot and links your Telegram account.
curl -X POST https://platform-api.anyspend.com/api/v1/notifications/telegram/link \
-H "Authorization: Bearer asp_xxx"
const { link_url } = await client.notifications.linkTelegram();
// Redirect the user or display the link
console.log("Open this link to connect Telegram:", link_url);
Response
{
"success": true,
"data": {
"link_url": "https://t.me/AnySpendBot?start=link_abc123def456",
"expires_at": "2026-02-27T12:15:00Z"
}
}
Generate link
Call POST /notifications/telegram/link to get a bot link URL.
Open in Telegram
Open the link_url in Telegram. Press Start in the bot conversation.
Enable notifications
Call PATCH /notifications with telegram_enabled: true.
The link URL expires after 15 minutes. Generate a new one if it expires before being used.
Unlink Telegram
DELETE /notifications/telegram
Disconnect Telegram from your notification settings. Telegram notifications will be automatically disabled.
curl -X DELETE https://platform-api.anyspend.com/api/v1/notifications/telegram \
-H "Authorization: Bearer asp_xxx"
await client.notifications.unlinkTelegram();
Send Test Email
POST /notifications/test/email
Send a test notification to your configured email address. Email must be enabled and an address must be set.
curl -X POST https://platform-api.anyspend.com/api/v1/notifications/test/email \
-H "Authorization: Bearer asp_xxx"
await client.notifications.testEmail();
Response
{
"success": true,
"data": {
"sent_to": "payments@mycompany.com",
"status": "sent"
}
}
Send Test Telegram Message
POST /notifications/test/telegram
Send a test notification to your linked Telegram account. Telegram must be linked and enabled.
curl -X POST https://platform-api.anyspend.com/api/v1/notifications/test/telegram \
-H "Authorization: Bearer asp_xxx"
await client.notifications.testTelegram();
Response
{
"success": true,
"data": {
"sent_to": "@merchant",
"status": "sent"
}
}
Notification Settings Object
| Field | Type | Description |
|---|
email_enabled | boolean | Whether email notifications are active |
email_address | string | null | Configured email address |
telegram_enabled | boolean | Whether Telegram notifications are active |
telegram_chat_id | string | null | Linked Telegram chat ID |
telegram_username | string | null | Linked Telegram username |
enabled_events | string[] | Event types that trigger notifications |
updated_at | string | ISO 8601 last update timestamp |
Supported Events
The same event types are available for both email and Telegram channels:
| Event Type | Description |
|---|
payment.completed | A payment was successfully processed |
payment.failed | A payment attempt failed |
checkout.completed | A checkout session completed with all form/shipping data |