← Back to Plugins
Channels

Cliq

bernesto By bernesto 👁 181 views ▲ 0 votes

Zoho Cliq channel plugin for OpenClaw — formatting conversion, draft streaming, multi-message chunking

GitHub

Configuration Example

{
  "plugins": {
    "entries": {
      "cliq": {
        "path": "~/.openclaw/workspace/plugins/cliq"
      }
    }
  }
}

README

# OpenClaw Zoho Cliq Plugin

A channel plugin that connects [OpenClaw](https://github.com/openclaw/openclaw) to [Zoho Cliq](https://www.zoho.com/cliq/), enabling AI agents to communicate via Cliq bots in DMs and channels.

## Features

- **Bot-per-agent architecture** — each OpenClaw agent maps to a Cliq bot, maintaining distinct personas
- **Markdown → Cliq formatting** — automatically converts standard Markdown to Cliq's native syntax
- **Draft streaming** — live typewriter effect via message send + edit, with throttling
- **Multi-message chunking** — long responses automatically split across multiple messages (Cliq has a 5K char limit)
- **Self-relay** — when one agent posts to a channel, other agents see the message and can respond
- **Rate limiting** — global rate limiter prevents API abuse (40 slots / 60s window)
- **Group chat support** — broadcast mode, mention gating, participant tracking, conversation history
- **Guardrails** — depth limits, hourly caps, per-agent/per-channel isolation

## Formatting Conversion

The plugin automatically converts standard Markdown (what LLMs output) to Cliq's native formatting:

| Standard Markdown | Cliq Native | Renders As |
|---|---|---|
| `**bold**` | `*bold*` | **bold** |
| `*italic*` | `_italic_` | *italic* |
| `~~strikethrough~~` | `~strike~` | ~~strikethrough~~ |
| `> blockquote` | `!blockquote` | blockquote |
| `| table |` | plain text | (tables not supported in Cliq) |

Code blocks, headings, links, and horizontal rules pass through unchanged (Cliq supports them natively).

## Prerequisites

- [OpenClaw](https://github.com/openclaw/openclaw) gateway running
- Zoho Cliq organization with API access
- One or more Cliq bots created (one per agent)
- Zoho OAuth credentials (client_id, client_secret, refresh_token)

## Installation

1. Clone this repo into your OpenClaw workspace:

```bash
git clone https://github.com/bernesto/openclaw-cliq-plugin.git \
  ~/.openclaw/workspace/plugins/cliq
```

2. Register the plugin in your OpenClaw config (`openclaw.json`):

```json
{
  "plugins": {
    "entries": {
      "cliq": {
        "path": "~/.openclaw/workspace/plugins/cliq"
      }
    }
  }
}
```

3. Configure the Cliq channel:

```json
{
  "channels": {
    "cliq": {
      "webhookToken": "your-webhook-secret",
      "webhookPath": "/cliq",
      "apiBase": "https://cliq.zoho.com/api/v2",
      "zohoTokensFile": "~/.openclaw/zoho-tokens.json",
      "zohoConfigFile": "~/.openclaw/zoho-config.json",
      "botMapping": {
        "your-bot-name": "your-agent-id"
      }
    }
  }
}
```

4. Restart the OpenClaw gateway.

## Zoho OAuth Setup

Create a Zoho OAuth client at [api-console.zoho.com](https://api-console.zoho.com/):

1. Create a **Self Client**
2. Required scopes: `ZohoCliq.Webhooks.CREATE`, `ZohoCliq.Messages.ALL`, `ZohoCliq.Channels.ALL`
3. Generate a refresh token
4. Save credentials to your config file:

```json
{
  "client_id": "your-client-id",
  "client_secret": "your-client-secret",
  "cliq": {
    "refresh_token": "your-refresh-token"
  }
}
```

## Cliq Bot Webhook Setup

Each Cliq bot needs a Deluge handler that forwards messages to OpenClaw:

```deluge
// Bot message handler
url = "https://your-openclaw-host/cliq";
headers = {"Authorization": "Bearer " + your_webhook_token};
payload = {
  "bot_unique_name": bot_unique_name,
  "message": message,
  "sender": sender,
  "chat": chat
};
response = invokeUrl(url, "POST", payload, headers);
```

## Bot Mapping

Map Cliq bot names to OpenClaw agent IDs in your config:

```json
{
  "channels": {
    "cliq": {
      "botMapping": {
        "assistant": "main",
        "engineer": "engineering",
        "support": "helpdesk"
      }
    }
  }
}
```

If no mapping is configured, the plugin falls back to built-in defaults.

## Channel Configuration

### Group Chat / Channel Settings

```json
{
  "channels": {
    "cliq": {
      "groups": {
        "your-channel-name": {
          "mode": "broadcast",
          "requireMention": true,
          "channelGuidance": "You are a helpful assistant in this channel."
        }
      }
    }
  }
}
```

### DM Policy

```json
{
  "channels": {
    "cliq": {
      "dm": {
        "policy": "open",
        "allowFrom": ["[email protected]"]
      }
    }
  }
}
```

Policy options: `"open"` (anyone in org), `"allowlist"` (specific users only), `"closed"` (DMs disabled).

## Architecture

```
Zoho Cliq Bot → Deluge Handler → HTTPS POST → OpenClaw /cliq webhook
                                                    ↓
                                              Plugin Monitor
                                                    ↓
                                              Agent Session
                                                    ↓
                                              Draft Stream → Cliq API (send/edit)
                                                    ↓
                                              Self-Relay → Other channel agents
```

## Guardrails

- **Relay depth limit** — prevents infinite agent-to-agent loops (default: 3)
- **Hourly message cap** — per-agent, per-channel rate limiting (default: 30/hour)
- **Concurrent relay cap** — limits simultaneous relay dispatches (default: 3)
- **Stagger delay** — 150ms between relay dispatches to avoid API bursts

## Tests

```bash
cd test && bash run-all.sh
```

Tests cover: bot roster management, conversation history, mention gating, group policy, group prompts, guardrails, and self-relay logic.

## Cliq Formatting Reference

| Syntax | Effect |
|---|---|
| `*text*` | **Bold** |
| `_text_` | *Italic* |
| `__text__` | Underline |
| `~text~` | ~~Strikethrough~~ |
| `` `text` `` | Inline quote (renders bold-red) |
| ` ```code``` ` | Code block |
| `!text` | Blockquote |
| `# text` | Large heading |
| `### text` | Small heading |
| `[text](url)` | Link |
| `---` | Horizontal rule |

**Not supported:** tables, bullet lists, numbered lists, nested formatting.

## License

MIT

## Contributing

Issues and PRs welcome. If you find formatting edge cases that don't convert properly, please include the raw Markdown input and a screenshot of how Cliq rendered it.
channels

Comments

Sign in to leave a comment

Loading comments...