🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@cf-agents/discord

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cf-agents/discord

A Cloudflare Agent integration package for Discord.

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

@cf-agents/discord

A Cloudflare Agent integration package for Discord.

Features

  • Send Messages: Post messages to channels.
  • Read History: Retrieve recent messages from a channel.

Installation

{
  "dependencies": {
    "@cf-agents/discord": "workspace:*"
  }
}

Initialize the tools with your Discord Bot Token and an optional default channel.

import { createDiscordTools } from "@cf-agents/discord";

const discordTools = createDiscordTools({
  getToken: async () => ({
    token: "YOUR_BOT_TOKEN"
  }),
  config: {
    channelId: "OPTIONAL_DEFAULT_CHANNEL_ID"
  }
});
```## Two-Way Messaging (Webhooks)

Handle incoming Discord interactions (slash commands) to trigger your agent.

```typescript
import { handleDiscordWebhook } from "@cf-agents/discord";

// In your fetch handler
const result = await handleDiscordWebhook(request, {
  DISCORD_PUBLIC_KEY: env.DISCORD_PUBLIC_KEY,
  DISCORD_TOKEN: env.DISCORD_TOKEN
});

if (result && "message" in result) {
  // Process with agent and reply
  await result.reply("Processing your request...");
}

FAQs

Package last updated on 04 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts