Home Tutorials Categories Skills About
ZH EN JA KO
Skills-Plugins

Developing Channel-Specific Tools for OpenClaw

· 14 min read

Overview

In OpenClaw's seven-stage tool pipeline, the fourth stage — "Channel-Specific Tools" — is a distinctive design. Different communication platforms offer vastly different interaction capabilities: Discord has rich embed messages and reaction systems, Telegram has inline keyboards and Bot API, Slack has Block Kit and workflows, and WhatsApp has template messages and interactive lists. Channel-specific tools enable AI agents to take full advantage of each platform's native features.

Channel Tool Architecture

Channel-specific tools are injected at the fourth stage of the tool pipeline. Based on the current session's channelType property, the system selects matching tools from the registered channel tool set and adds them to the tool list.

channelTools:
  discord:
    - discord_embed
    - discord_reaction
    - discord_thread
    - discord_voice
  telegram:
    - telegram_keyboard
    - telegram_sticker
    - telegram_poll
  slack:
    - slack_blocks
    - slack_workflow
    - slack_modal
  whatsapp:
    - whatsapp_template
    - whatsapp_list
    - whatsapp_location

Discord-Specific Tools

discord_embed — Embed Message Tool

Discord embed messages support rich formatted content including titles, descriptions, fields, images, thumbnails, and footers. This tool enables AI agents to create visually appealing structured messages.

Tool parameters include: title, description, color, fields (array), thumbnail, image, footer, and timestamp. The AI agent automatically selects the appropriate layout based on the content type.

discord_reaction — Reaction Management Tool

Manages emoji reactions on messages. AI agents can add reactions as an alternative to interactive buttons, or read user reactions to collect feedback. Supports both Unicode emojis and server custom emojis.

discord_thread — Thread Tool

Creates and manages threads within Discord channels. When a conversation involves a specific topic, the AI agent can automatically create a thread to keep the main channel organized. The thread tool also supports archiving and locking operations.

discord_voice — Voice Channel Tool

Provides basic voice channel interaction capabilities, such as joining a voice channel, playing audio, and getting the voice channel member list.

Telegram-Specific Tools

telegram_keyboard — Inline Keyboard Tool

Telegram's most distinctive interaction method is the inline keyboard. This tool allows AI agents to attach a button grid below messages, where button clicks trigger corresponding actions.

Two keyboard types are supported:

  • Inline keyboard: Attached below messages, button clicks trigger callbacks
  • Reply keyboard: Replaces the user's soft keyboard, providing quick reply options

telegram_sticker — Sticker Tool

Send and manage stickers. AI agents can choose appropriate sticker responses based on the conversation mood, adding a fun element to interactions.

telegram_poll — Poll Tool

Creates poll messages, supporting both single-choice and multiple-choice modes. Ideal for gathering team opinions, decision voting, and similar scenarios.

Slack-Specific Tools

slack_blocks — Block Kit Tool

Slack's Block Kit is a powerful message building framework. This tool enables AI agents to create complex interactive messages containing text, images, buttons, selectors, date pickers, and other components.

The Block Kit tool automatically validates message structures, ensuring generated blocks comply with Slack API specifications.

slack_workflow — Workflow Tool

Integrates with Slack Workflow Builder, allowing AI agents to trigger predefined workflows or create simple automation processes.

slack_modal — Modal Tool

Opens modal dialogs in Slack to collect structured user input. Modals support multiple input fields, validation rules, and multi-step forms.

WhatsApp-Specific Tools

whatsapp_template — Template Message Tool

The WhatsApp Business API requires proactive messages to use pre-approved templates. This tool manages template selection and parameter population, ensuring messages comply with WhatsApp's policy requirements.

whatsapp_list — List Message Tool

Sends interactive messages with selectable list items. Suitable for menu displays, option selection, and similar scenarios. Lists support up to 10 sections, with up to 10 items per section.

whatsapp_location — Location Tool

Sends and receives geographic location information. AI agents can mark locations on a map or parse location data sent by users.

Developing Custom Channel Tools

Tool Registration

Custom channel tools are registered programmatically in the OpenClaw system:

openclaw.registerChannelTool({
  channel: 'discord',
  name: 'discord_custom_tool',
  description: 'Description of the custom Discord tool',
  parameters: {
    type: 'object',
    properties: {
      param1: { type: 'string', description: 'Parameter description' }
    },
    required: ['param1']
  },
  execute: async (params, context) => {
    // Tool execution logic
    return { result: 'Operation complete' };
  }
});

The Context Object

The channel tool's execution function receives a context object containing:

  • channel: The channel instance, providing access to platform-native APIs
  • session: Current session information
  • user: Current user information
  • abortSignal: The abort signal from the seventh stage of the pipeline

System Prompt Adaptation

After registering a channel tool, remember to use the buildAgentSystemPrompt() extension prompt mechanism to provide the AI agent with guidance on using the new tool. Otherwise, the agent may not know when or how to call it.

Testing Channel Tools

OpenClaw provides a channel simulator that lets you test channel tools during development without connecting to the actual platform. The simulator mimics each platform's API responses and interaction behaviors.

Best Practices

  1. Respect platform conventions: Each platform has its own design guidelines and limitations — tools should adhere to these
  2. Graceful degradation: If a channel feature is unavailable, the tool should return a meaningful error message rather than crash
  3. Async safety: Channel API calls are asynchronous — ensure proper handling of concurrency and timeouts
  4. User privacy: Channel tools may access users' platform data — always follow the principle of least privilege

Summary

Channel-specific tools are a vital component of OpenClaw's multi-platform architecture. By providing customized tools for each communication platform, AI agents can deliver a native-level interaction experience across different environments.

OpenClaw is a free, open-source personal AI assistant that supports WhatsApp, Telegram, Discord, and many more platforms