← Back to Plugins
Channels

Pachca

flobo3 By flobo3 👁 5 views ▲ 0 votes

Pachca (Пачка) channel plugin for OpenClaw — WIP

GitHub

Configuration Example

channels:
  pachca:
    token: "your-bot-access-token"
    webhookSecret: "signing-secret-from-pachca"
    apiBase: "https://api.pachca.com/api/v1"  # optional, default shown
    allowFrom: ["123", "456"]                   # user IDs allowed to DM the bot
    dmPolicy: "allowlist"                        # allowlist | owner_only | open
    groupPolicy: "allowlist"                     # allowlist | open
    groups:
      "789":
        allowFrom: ["123"]
        requireMention: true

README

# openclaw-pachca

> **WIP — Work in Progress**

Pachca (Пачка) channel plugin for [OpenClaw](https://github.com/openclaw/openclaw). Enables OpenClaw agents to communicate through the Pachca corporate messenger via REST API and webhooks.

## What's here

- `src/client.ts` — Pachca REST API client (messages, chats, users, reactions, file uploads)
- `src/channel.ts` — OpenClaw `ChannelPlugin` implementation (outbound, security, gateway)
- `src/monitor.ts` — Webhook listener (signature verification, event parsing)
- `src/send.ts` — Outbound message sending (text + media)
- `src/accounts.ts` — Account resolution from OpenClaw config
- `src/setup-core.ts` — Setup adapter (placeholder)

## Status

This is an early prototype. The plugin structure follows the patterns used by built-in channels (IRC, Telegram, Slack), but several critical pieces are incomplete.

### What works (structurally)

- Plugin manifest and entry point (`defineChannelPluginEntry`)
- Account resolution from `channels.pachca.*` config
- Pachca API client with message sending, editing, reactions, file uploads
- Outbound `sendText` and `sendMedia` hooks
- Webhook signature verification and event parsing
- Config: `channels.pachca.token`, `channels.pachca.webhookSecret`, `channels.pachca.apiBase`

### What's missing / needs work

1. **Webhook listener is a stub** — `monitor.ts` has parsing logic but doesn't register an HTTP route on the gateway. Needs integration with OpenClaw's webhook router (follow Slack's Socket Mode pattern or register a POST handler).
2. **File upload flow incomplete** — `sendMediaPachca` sends a text placeholder instead of the full 3-step flow (createUpload → PUT to S3 → sendMessage with key).
3. **Setup wizard** — `setup-core.ts` is a placeholder. Needs interactive token configuration flow.
4. **Config schema** — `openclaw.plugin.json` has an empty configSchema. Should define token, webhookSecret, apiBase, allowFrom, groups, etc.
5. **Threading** — Pachca has cross-chat threads (thread_id). The threading model needs mapping to OpenClaw's session routing, similar to how Telegram handles topics.
6. **Forms / Buttons** — Pachca supports interactive forms and inline buttons. Not yet implemented.
7. **Tests** — None yet.
8. **Streaming** — Pachca doesn't support streaming natively. Need to decide: chunk messages or use edit-based streaming (edit the same message as tokens arrive).
9. **Pairing** — The `notify` function in pairing is a no-op.
10. **Runtime module injection** — Following Telegram's pattern of lazy-loaded runtime modules (`loadTelegramSendModule`, etc.) for tree-shaking.

### Known issues

- `channel.ts` references `account.config.apiBase` but `ResolvedPachcaAccount` has `apiBase` at top level — needs fix
- No error recovery for failed webhook deliveries
- No retry logic for API calls
- `resolveTargets` is naive — returns input as-is without verifying the entity exists

## Architecture notes

Pachca differs from Telegram in key ways:

| Aspect | Telegram | Pachca |
|--------|----------|--------|
| Inbound | Long-polling or webhook | Outgoing webhook only (platform POSTs to you) |
| File uploads | Send directly | 3-step: createUpload → PUT S3 → attach key |
| Threading | reply_to_message_id | Separate thread_id entity (cross-chat threads) |
| Bot auth | Bot token from @BotFather | Bearer token from workspace settings |
| Interactive | Inline keyboards | Forms + buttons |
| Message formatting | HTML | Markdown |

## Config reference

```yaml
channels:
  pachca:
    token: "your-bot-access-token"
    webhookSecret: "signing-secret-from-pachca"
    apiBase: "https://api.pachca.com/api/v1"  # optional, default shown
    allowFrom: ["123", "456"]                   # user IDs allowed to DM the bot
    dmPolicy: "allowlist"                        # allowlist | owner_only | open
    groupPolicy: "allowlist"                     # allowlist | open
    groups:
      "789":
        allowFrom: ["123"]
        requireMention: true
```

## Contributing

Contributions are welcome! This project is in early stages and there's plenty to do. Areas of particular interest:

- Webhook gateway integration (tying into OpenClaw's HTTP server)
- File upload 3-step flow
- Threading model
- Setup wizard
- Tests

Open an issue or PR. No strict rules yet — just be reasonable.

## License

MIT
channels

Comments

Sign in to leave a comment

Loading comments...