Skip to Content
DocumentationFeatureNotification Management

Notification Management

Background

Notifications are a high-touch feature. Unlike low-visibility background tasks such as model runs and training, notifications are more about user interactions. Each user has different frequency preferences.

Based on this, since v0.2.5 I separated notifications from the core logic to avoid over-notifying some users.

Now you can integrate notifications into your system with simple settings.

The flow has two main steps:

  1. Configure notification sources and targets
  2. Configure notification tasks

Notification source management

The following sources are supported:

Email

This source requires configuration. Set host and port based on your email provider, and fill username and password with your email account credentials.

{ "host": "smtp.example.com", "port": 587, "username": "your_email@example.com", "password": "your_password" }

Note: the password here is not your email password. It is the SMTP authorization code. See your email provider’s documentation for how to obtain it.

For example, in 163 Mail, you can get the SMTP authorization code by enabling SMTP. A popup will show a string, which is the SMTP authorization code. To use this source, you must enable SMTP.

Feishu

This source requires app_id and app_secret.

{ "app_id": "cli_a3f3d6a3a3f3d6a3a", "app_secret": "dkamsklmlksamkl" }

Because Feishu does not allow direct linking to external files and images in notifications, you need to configure a bot with permission to upload files/images to Feishu. Steps:

  1. Go to the Feishu Developer Console  and create a custom enterprise app. After creation, open the app details page and copy the app id and app secret into the configuration.
  2. Enable image upload permissions for the app.

DingTalk

No configuration is required for this source for now.

Apple APNS

This source is more complex. See the Apple developer docs: https://developer.apple.com/documentation/usernotifications/sending-notification-requests-to-apns 

{ "team_id": "your team_id" }
  1. Go to the Apple Developer site  and log in to your Apple developer account.
  2. In Membership details, you can find your Team ID.
  3. Go to the Certificates, Identifiers & Profiles page, create a Key, and set parameters. Enable APNS and set the environment (Production/Sandbox).
  4. On the Key details page you can see the Key ID.
  5. Click Download to get the Key file. The file content is the Private Key.
  6. apns_topic is the Bundle ID of your app.

Apple APNS (SandBox)

Same as above, but make sure your Key is for the sandbox environment.

Telegram

This source requires configuration:

{ "bot_token": "your_bot_token" }
  1. Open Telegram and search for @BotFather to find the bot creation assistant.
  2. Click Start (skip if already done).
  3. Enter /newbot.
  4. Follow the prompts to set the bot’s name.
  5. Follow the prompts to set the bot’s id. The id must be globally unique in Telegram and end with bot.
  6. After creation, BotFather will return a message with the bot token. Copy it into the configuration.

Notification target management

The following targets are supported:

Email

This target requires configuration:

{ "email": "your_email@example.com" }

email is the address you want to send notifications to.

Feishu

This target requires configuration:

{ "webhook_url": "https://open.feishu.cn/open-apis/bot/v2/hook/xxxxxxxxxxxxxxxxxxxxx", "sign": "xxxxxxxxx" }
  1. Create a custom webhook bot in a group.
  2. Open the bot configuration details and enable signature.
  3. Copy Webhook URL and signature into the configuration.

DingTalk

Same as Feishu above.

Apple APNS

{ "device_token": "your_device_token" }
This method is for developers. You must have the device’s unique ID for your app.

To obtain it, configure your app code as follows:

class AppDelegate: NSObject, UIApplicationDelegate, UNUserNotificationCenterDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { registerForRemoteNotifications() UNUserNotificationCenter.current().delegate = self return true } func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { // If registration succeeds, this function is called // Store in UserDefaults UserDefaults(suiteName: "group.com.qingyon.Revornix")!.set(deviceToken.hexString, forKey: "device_token") print("deviceToken:", deviceToken.hexString) } func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) { print("Failed to register for remote notifications: \(error)") } ... }

Apple APNS (SandBox)

Same as above.

Telegram

This target requires configuration:

{ "chat_id": "your_chat_id" }
  1. Create a Telegram group.
  2. Invite your Telegram bot to the group.
  3. Send a message starting with / in the group.
  4. Open https://api.telegram.org/bot[your bot_token]/getUpdates (replace [your bot_token] with your token) and search for the message you just sent.
  5. Find the id in the response, copy it, and fill it in the configuration.

Notification task management

Note: notification sources and targets must match, otherwise notifications cannot be sent. See the table below.

Notification SourceNotification Target
EmailEmail
FeishuFeishu
DingTalkDingTalk
Apple APNSApple APNS
Apple APNS (SandBox)Apple APNS (SandBox)
TelegramTelegram

Both time triggers and event triggers are supported. Choose according to your needs.

Currently supported events:

  • RemovedFromSection: you were removed from a section
  • SectionCommented: a section you created or participated in was commented
  • SectionSubscribed: a section you created or participated in was subscribed
  • SectionUpdated: a section you participated in or subscribed to was updated

Custom notification content and template content are both supported. If you need real-time messages, you must choose template content because custom content is fixed when you configure it and cannot be updated dynamically.

Available templates:

  • Daily Summary Template
  • Removed From Section Template
  • Section Commented Template
  • Section Subscribed Template
  • Section Updated Template
Last updated on