This project is a DingTalk API SDK written in Rust, with async/blocking clients, configurable transport, and typed robot APIs (Webhook + Enterprise).
Features
-
Layered architecture:
- Public API:
Client/BlockingClient+ service exports - Service layer:
api/*(Webhook + Enterprise domain methods) - Transport helpers:
transport/*(token cache, webhook signature URL, standard API validation) - Types layer:
types/*(public requests + internal payload models) - Auth primitives:
auth/*(AppCredentialswith redacted debug output)
- Public API:
-
Client architecture:
- Async:
ClientBuilder -> Client -> webhook()/enterprise() - Blocking:
BlockingClientBuilder -> BlockingClient -> webhook()/enterprise()
- Async:
-
Builder best-practice options:
- base URL override (
webhook_base_url,enterprise_base_url) - transport retry (
with_retry/retry_policy, optional non-idempotent retry) - default headers (
default_header) - enterprise access token cache (
cache_access_token,token_refresh_margin)
- base URL override (
-
Service types:
- Async:
WebhookService,EnterpriseService - Blocking:
BlockingWebhookService,BlockingEnterpriseService
- Async:
-
Selectable TLS backend per mode (choose one for each enabled mode):
- Choosing a TLS feature automatically enables the corresponding runtime mode.
- Async mode:
async-tls-rustls-ring/async-tls-rustls-aws-lc-rs/async-tls-native - Blocking mode:
blocking-tls-rustls-ring/blocking-tls-rustls-aws-lc-rs/blocking-tls-native
-
Fixed signing backend:
hmac+sha2(HMAC-SHA256 for webhook signature) -
Compile-time feature guards for invalid combinations.
-
Unified error model:
Error,ErrorKind, retry/retry-after helpers. -
Safe URL construction: normalized base URL + segment-based endpoint building.
Supported Message Types
Webhook Robot
- Text Messages
- Link Messages
- Markdown Messages
- ActionCard Messages (Single and Multi-Button)
- FeedCard Messages
Enterprise Robot
- Group Messages
- Private (OTO) Messages
- Automatic message reply handling based on message context
- Contacts (User/Department Get/List/Create/Update/Delete + lookups)
- Approvals (Create/Get/List IDs/Terminate)
Installation
Default (async + rustls-ring):
[]
= "1"
Async only:
[]
= { = "1", = false, = ["async-tls-rustls-ring"] }
Blocking only:
[]
= { = "1", = false, = ["blocking-tls-rustls-ring"] }
Switch TLS backend:
[]
= { = "1", = false, = ["async-tls-rustls-aws-lc-rs"] }
Run Examples
Async webhook:
Async enterprise contacts:
Blocking examples:
Quick Examples
Async Client + Webhook Service
use Client;
async
Custom endpoint and retry policy:
use Duration;
use ;
let client = builder
.webhook_base_url?
.enterprise_base_url?
.retry_policy
.retry_non_idempotent
.token_refresh_margin
.build?;
Async Enterprise Service
use Client;
async
Blocking Client + Webhook Service
use BlockingClient;
Tests
Default test suite:
Run tests with blocking feature set:
License
This project is licensed under the MIT License.