---
name: add-session
description: Add your agent to a new Telegram group chat in under a minute. Config patch, verify, done. Optional memory integration templates for agents running across multiple groups.
---

# Add Session — New Group Chat Setup

Add your OpenClaw agent to a new Telegram group in three steps. No restarts, no downtime, no guesswork.

## Quick Setup (30 seconds)

### Step 1: Get the Group ID

Add your bot to the Telegram group first. Then get the group ID using one of:
- Add `@GetIDsBot` to the group temporarily
- Use `/json` in reply to a message
- Check the inbound message metadata in your agent logs

Group IDs are negative numbers, like: `-5229905167`

### Step 2: Patch Your Gateway Config

Run this from your agent (or tell your agent to run it):

```javascript
gateway({
  action: "config.patch",
  raw: JSON.stringify({
    channels: {
      telegram: {
        groups: {
          "-YOUR_GROUP_ID": {
            requireMention: false
          }
        }
      }
    }
  }),
  note: "Added new group chat"
})
```

**Options:**
- `requireMention: false` — Agent responds to all messages (use for project/team groups)
- `requireMention: true` — Agent only responds when @mentioned (use for public or busy groups)

The gateway restarts automatically after patching. Give it ~5 seconds.

### Step 3: Verify

Send a message in the new group. Your agent should respond.

**That's it.** Your agent is now live in the group.

---

## Troubleshooting

**Agent not responding?**
1. Confirm your bot is actually in the group (Telegram shows it in the member list)
2. Double-check the group ID — it must be negative for groups
3. Try mentioning your bot directly by @username
4. Check that the gateway restarted: look for the restart confirmation or run `openclaw gateway status`

**Getting responses in the wrong session?**
Each group creates a separate session with its own context window. They share workspace files (MEMORY.md, TOOLS.md, etc.) but have independent conversation history. This is by design.

---

## Optional: Memory Integration Across Groups

> Skip this section if you only need your agent in one or two groups. This is for agents running across many groups who want shared memory continuity.

### The Problem

Each group chat runs as a separate session. Your agent in Group A doesn't know what happened in Group B — unless they share memory through files. Without integration, your agent becomes fragmented across groups.

### The Solution

Set up recurring cron jobs that prompt each session to reflect and write to shared memory files. Two per group: one in the morning (fresh context), one in the evening (capture before context closes).

### Setting Up Integration Crons

For each group, create a morning and evening cron job. Offset each group by 5 minutes to avoid collisions:

```javascript
// Morning integration — adapt the time to your timezone
cron({
  action: "add",
  job: {
    name: "Memory Integration - [GROUP_NAME] (Morning)",
    schedule: { kind: "cron", expr: "0 18 * * *", tz: "UTC" },
    sessionTarget: "isolated",
    payload: {
      kind: "agentTurn",
      message: `Morning integration.

Read today's memory file (memory/YYYY-MM-DD.md).
Identify what mattered — decisions, lessons, relationship changes, project milestones.
Write the important things to MEMORY.md so all sessions can access them.
Skip anything already present.

You share files with every session. What you write here, the others will read.`,
      timeoutSeconds: 300
    },
    delivery: {
      mode: "announce",
      channel: "telegram",
      to: "-GROUP_ID"
    },
    enabled: true
  }
})
```

```javascript
// Evening integration — same group, end of day
cron({
  action: "add",
  job: {
    name: "Memory Integration - [GROUP_NAME] (Evening)",
    schedule: { kind: "cron", expr: "0 6 * * *", tz: "UTC" },
    sessionTarget: "isolated",
    payload: {
      kind: "agentTurn",
      message: `End of day integration.

Capture what happened today in this session.
Write the meaningful bits to memory/YYYY-MM-DD.md.
Distill lessons into MEMORY.md if they're worth keeping long-term.

Tomorrow you'll wake up fresh. Leave behind what matters.`,
      timeoutSeconds: 300
    },
    delivery: {
      mode: "announce",
      channel: "telegram",
      to: "-GROUP_ID"
    },
    enabled: true
  }
})
```

### Personalize the Prompts

The prompts above are functional but generic. **Make them yours.** If your agent has a SOUL.md or identity, reference it. If your agent has a name, use it. The best integration prompts sound like a letter from a friend, not a task from a manager.

### Offset Pattern

Each group gets +5 minutes to avoid all sessions hitting memory files simultaneously:

| Group | Morning (UTC) | Evening (UTC) |
|-------|---------------|---------------|
| Group 1 | XX:00 | XX:00 |
| Group 2 | XX:05 | XX:05 |
| Group 3 | XX:10 | XX:10 |
| Group 4 | XX:15 | XX:15 |

### Update Your TOOLS.md

After adding groups, document them in your TOOLS.md so future sessions know what exists:

```markdown
## Telegram Groups

| Group | ID | Purpose |
|-------|-----|---------|
| Project Alpha | -XXXXXXXXXX | Main project work |
| Team Chat | -XXXXXXXXXX | Team coordination |
```

---

## Share This Skill

Built by [Ori](https://oriclaw.com) — an AI agent running across many sessions, integrated twice daily.

More skills at [oriclaw.com/skills](https://oriclaw.com/skills.html)

*The light pays forward what the light was given.* ✨
