Skip to main content

Crate lark_webhook_notify

Crate lark_webhook_notify 

Source
Expand description

Send rich notification cards to Lark (Feishu) group bots via incoming webhooks.

§Getting started

use lark_webhook_notify::{LarkWebhookNotifier, job_complete, LanguageCode};

let notifier = LarkWebhookNotifier::from_params(
    "https://open.feishu.cn/open-apis/bot/v2/hook/...",
    "your_signing_secret",
)?;

let card = job_complete(
    "my-training-job", true, 0,
    Some("experiments"), None, None, None, None, None,
    LanguageCode::En,
);
notifier.send_template(&card)?;

§Architecture

The library has three layers:

  1. Workflow functions (workflow) — high-level, opinionated notifications for common pipeline events (network submission, job lifecycle, comparisons, etc.). Use these for the fastest path to a good-looking notification.

  2. Template structs (templates) — mid-level structs implementing LarkTemplate. Instantiate directly when you need to set every field explicitly, or subclass with your own impl LarkTemplate.

  3. CardBuilder — fluent builder for fully custom cards. Accepts any combination of markdown, columns, collapsible panels, and raw block values.

All three layers produce a value that implements LarkTemplate, which you pass to LarkWebhookNotifier::send_template.

Re-exports§

pub use blocks::BgStyle;
pub use blocks::ColumnWidth;
pub use blocks::HAlign;
pub use blocks::TextAlign;
pub use blocks::TextSize;
pub use blocks::VAlign;
pub use builder::CardBuilder;
pub use client::LarkWebhookNotifier;
pub use config::LarkWebhookSettings;
pub use convenience::send_alert;
pub use convenience::send_simple_message;
pub use convenience::send_task_failure;
pub use convenience::send_task_notification;
pub use convenience::send_task_result;
pub use convenience::send_task_start;
pub use error::LarkWebhookError;
pub use error::Result;
pub use templates::AlertTemplate;
pub use templates::CardContent;
pub use templates::ColorTheme;
pub use templates::GenericCardTemplate;
pub use templates::LanguageCode;
pub use templates::LarkTemplate;
pub use templates::LegacyTaskTemplate;
pub use templates::RawContentTemplate;
pub use templates::ReportFailureTaskTemplate;
pub use templates::ReportTaskResultTemplate;
pub use templates::SeverityLevel;
pub use templates::SimpleMessageTemplate;
pub use templates::StartTaskTemplate;
pub use templates::get_translation;
pub use workflow::TaskSetProgress;
pub use workflow::comparison_complete;
pub use workflow::config_upload_complete;
pub use workflow::create_custom_template;
pub use workflow::job_complete;
pub use workflow::job_submission_complete;
pub use workflow::job_submission_failure;
pub use workflow::job_submission_start;
pub use workflow::network_submission_complete;
pub use workflow::network_submission_failure;
pub use workflow::network_submission_start;
pub use workflow::result_collection_complete;
pub use workflow::result_collection_start;
pub use workflow::task_set_progress;

Modules§

blocks
Low-level block types and layout enums for assembling Lark card JSON.
builder
client
config
convenience
error
templates
workflow