discord_interactions
0.0.24, released a year ago by rexios.dev
A Dart client for Discord Interactions using webhooks, suited for serverless bots.
What it does
Provides classes to validate Discord webhook requests, build interaction responses, and call Discord's REST API. It wraps Dio and adds response validation for reliable serverless operation.
AI-written summary of version 0.0.24, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need a lightweight Discord bot that runs on serverless platforms like Cloud Run
- You want to handle slash commands and other interactions via webhooks without managing a gateway connection
Skip it when
- You require real‑time events via the Discord gateway
- You need a full‑featured Discord client with voice or streaming support
Strengths
- Full support for many Discord API endpoints, unit‑tested
- Designed for serverless deployment with minimal runtime overhead
- Uses Dio with response validation for robust HTTP calls
Weaknesses
- Only works with webhook‑based interactions, no gateway support
- Package is still in‑progress and may lack some advanced features
Setup
- Kind
- Pure Dart
- Effort
- Medium
- Code generation
- Yes (build_runner)
- Direct dependencies
- 6
Add the package, provide your application public key, bot token or credentials token, and configure DiscordUserAgent; no build_runner needed
final validator = InteractionValidator(applicationPublicKey: 'YOUR_KEY');
final valid = validator.validate(headers: request.headers, body: body);
if (!valid) return Response(401, body: 'invalid request signature');
final interaction = Interaction.fromJson(jsonDecode(body));
if (interaction.type == InteractionType.ping) {
return Response.ok(jsonEncode(InteractionResponse.pong()));
}Alternatives
Packages that do the same job and could replace discord_interactions.
- posthog_flutter
Flutter client for PostHog analytics, feature flags, and session replay
84Compare - meilisearch
Meilisearch API client for Dart and Flutter developers
67Compare
Works with
Packages commonly used together with discord_interactions: ones it builds on, ones built on it, and its own family.
- json_annotationdiscord_interactions depends on itProvides annotations for json_serializable to generate JSON (de)serialization code.
- convertdiscord_interactions depends on itEncoders and decoders for converting between different data representations.
- diodiscord_interactions depends on itA powerful HTTP networking package for Dart and Flutter with interceptors and request cancellation.
- pinenacldiscord_interactions depends on itDart implementation of TweetNaCl cryptographic library with high-level APIs