Skip to content
pubscout

discord_interactions

0.0.24, released a year ago by rexios.dev

A Dart client for Discord Interactions using webhooks, suited for serverless bots.

WASM-ready
$ flutter pub add discord_interactions
Source repository

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.

Works with

Packages commonly used together with discord_interactions: ones it builds on, ones built on it, and its own family.