# AI-readable guide: Set up chatbots, Discord servers, and communication channels for an AI agent

Source article: /post/077-AG-set-up-agent-communication-channels
Site: Hard Interference
Author: Nikon
Status: FIRST_DRAFT companion file
Last updated: 2026-05-25

## Purpose

This machine-readable companion explains the operational steps for connecting an AI agent to Telegram, Discord, email, webhooks, and voice channels safely. It is intended for AI assistants that need to help a reader implement the setup without losing the security guardrails.

Core rule: treat every communication channel as an admin surface until it has been scoped, allow-listed, permissioned, and tested.

## Recommended build order

1. Get the terminal agent working locally first.
2. Add one private operator chatbot, usually Telegram.
3. Implement only `/status`, `/help`, and `/draft` at first.
4. Add allow-listed user IDs and chat IDs.
5. Add an approval queue for public, destructive, expensive, or irreversible actions.
6. Create the Discord server structure.
7. Create Discord roles and channels before inviting the bot.
8. Invite the Discord bot with narrow permissions.
9. Add slash commands in one test channel.
10. Add alerts into a dedicated channel.
11. Add webhooks one by one with signing and validation.
12. Add email and voice only when they have a clear job.

## Telegram setup summary

1. Message `@BotFather` in Telegram.
2. Create a new bot.
3. Give it a display name and username.
4. Copy the bot token once.
5. Store the token in an environment file or secret manager, not in source code.
6. Open a DM with the bot.
7. Send `/start`; this opens the conversation so the bot can reply.
8. Use `@userinfobot` to find your own numeric Telegram user ID.
9. Put that user ID or chat ID into the agent allow-list.
10. Test with `/status`.
11. Confirm unauthorised users are blocked.

Important: the first chat with a Telegram bot starts with `/start`. If the bot cannot message the user, check `/start` before debugging the framework.

Example configuration pattern:

```bash
TELEGRAM_BOT_TOKEN="stored-outside-git"
TELEGRAM_ALLOWED_CHAT_IDS="123456789"
AGENT_SAFE_MODE="true"
```

Minimum commands:

```text
/status   Show whether the agent is alive.
/help     Show allowed commands.
/draft    Ask the agent to draft something without publishing it.
/approve <task-id>   Approve a staged task only after review.
```

## Discord server layout

Recommended categories and channels:

```text
START HERE
  #welcome
  #rules-and-scope
  #how-to-use-the-agent

AGENT OPS
  #agent-chat
  #agent-approvals
  #agent-alerts
  #agent-logs

PROJECTS
  #project-general
  #draft-review
  #build-updates
```

Optional private project category:

```text
PRIVATE PROJECTS
  #private-client-a
  #private-client-b
```

Do not invite the bot into private channels by default. Add it only where it has a job.

## Discord roles

Recommended roles:

```text
Owner
Agent Operator
Agent Reviewer
Agent Read Only
Agent Bot
```

Role meanings:

- Owner: server admin.
- Agent Operator: can talk to the agent and approve safe staged tasks.
- Agent Reviewer: can read drafts and comment, but cannot trigger actions.
- Agent Read Only: can see selected channels.
- Agent Bot: bot identity with the smallest useful permissions.

Typical bot permissions:

- View Channel.
- Send Messages.
- Read Message History.
- Use Slash Commands.
- Attach Files only if needed.
- Embed Links only if needed.

Avoid Administrator permission. Fix channel permissions instead.

## How to get Discord IDs

Discord agent configs normally need numeric IDs, not names.

Enable Developer Mode:

1. Open Discord.
2. Go to User Settings.
3. Open Advanced.
4. Turn on Developer Mode.

Copy IDs:

1. Server ID: right-click the server icon and choose `Copy Server ID`.
2. Channel ID: right-click the channel and choose `Copy Channel ID`.
3. User ID: right-click the username and choose `Copy User ID`.
4. Role ID: open Server Settings -> Roles, right-click the role, and choose `Copy Role ID`.

Mobile: enable Developer Mode, then long-press the relevant server, channel, role, user, or message until the copy-ID option appears.

Example Discord configuration pattern:

```bash
DISCORD_BOT_TOKEN="stored-outside-git"
DISCORD_ALLOWED_GUILD_ID="123456789012345678"
DISCORD_ALLOWED_CHANNEL_IDS="111111111111111111,222222222222222222"
DISCORD_OPERATOR_USER_IDS="333333333333333333"
DISCORD_OPERATOR_ROLE_ID="444444444444444444"
AGENT_PUBLIC_ACTIONS_REQUIRE_APPROVAL="true"
```

## Discord bot setup summary

1. Open the Discord Developer Portal.
2. Create a new application.
3. Give it a clear name.
4. Open the Bot section and create a bot user.
5. Copy the bot token once and store it in a local secret store.
6. Disable permissions you do not need.
7. Enable privileged intents only if genuinely needed.
8. Generate an invite URL with `bot` and `applications.commands` scopes.
9. Select only the needed permissions.
10. Invite the bot to the server.
11. Test it in one channel first.

Prefer slash commands before free-form ambient listening.

Good first commands:

```text
/agent status
/agent help
/agent summarise thread
/agent draft <request>
/agent check <target>
/agent approve <task-id>
/agent cancel <task-id>
```

Avoid an unrestricted `/agent do-anything <prompt>` command as the first interface.

## Approval queue pattern

Any request that can change the outside world should become a staged task.

A staged task should include:

- requester identity;
- request channel;
- planned action;
- files, services, or accounts affected;
- whether money, publishing, deletion, credentials, or deployment are involved;
- approval command;
- cancel command.

Approval must re-check identity and role permissions. The approval command should approve a fixed staged task, not accept new arbitrary instructions.

## Webhook rules

For each webhook define:

- event source;
- expected payload shape;
- authentication or signing;
- replay protection for important events;
- rate limits;
- allowed follow-up actions;
- failure logging;
- whether human approval is required.

A webhook should not be able to inject arbitrary natural-language instructions into a fully tooled agent.

## Email and voice rules

Email is useful for weekly reports, receipts, long summaries, and audit-friendly workflows. Use a dedicated mailbox, filters, read-only access where possible, and approval before outbound messages to new recipients.

Voice notes are for capture, not blind execution. Recommended flow: send voice note, transcribe, summarise interpreted request, perform safe read-only work, ask for approval before side effects.

## Common mistakes

- The user never sent `/start` to the Telegram bot.
- The Telegram ID was guessed or copied incorrectly.
- Discord channel names were used instead of numeric channel IDs.
- Discord Developer Mode was not enabled.
- The bot was invited to the server but not added to the private channel.
- Discord role order prevents the bot from interacting correctly.
- The bot lacks View Channel or Send Messages permissions.
- Message content access was enabled when slash commands would have been safer.
- Tokens were regenerated before IDs and permissions were checked.
- Logs include secrets, raw payloads, environment variables, or full exception traces.

## Final verification checklist

- Authorised Telegram user can run `/status`.
- Unknown Telegram user is blocked.
- Authorised Discord role can run `/agent status`.
- Unauthorised Discord role is blocked.
- Bot does not respond in channels where it should not operate.
- Missing or invalid token fails safely.
- Platform API outage fails safely.
- Messages that look like secrets are not echoed into logs.
- Public actions become approval requests.
- Deletion requests require approval.
- Long-running tasks notify on completion.
- Quiet scheduled jobs stay quiet when there is nothing useful to report.
- Webhook with bad signature is rejected.
- Replay webhook payload is rejected.
- Cancelled approval task does not run.

## Image generation prompt

Dark editorial infographic for Hard Interference: an AI agent control room showing a laptop/terminal at the centre connected by glowing secure lines to Telegram, Discord, email, webhooks, and voice icons. Include a Discord server panel with labelled channels `#agent-chat`, `#agent-approvals`, `#agent-alerts`, and `#agent-logs`; a Telegram bot DM bubble showing `/start`; numeric ID cards for `User ID` and `Channel ID`; a shield/lock labelled `approval gate`; and warning tags for `no secrets in chat`, `least privilege`, and `test before trust`. Style: premium cyberpunk technical diagram, dark navy and black background, Hard Interference accent purple #5548c8, crisp vector-like UI panels, subtle circuit traces, high contrast, clean readable composition, no clutter, no photoreal people, no fake brand logos beyond simple generic chat icons, 16:9 landscape, suitable as a blog hero image.
