mirror of
https://github.com/cline/cline.git
synced 2026-09-16 21:01:52 +08:00
* fix(cli): infer Telegram bot username from token
* fix(cli): address Telegram connector review feedback
* test(cli): confirm Telegram schedule delivery bot metadata
* fix(core): publish schedule completion events to connectors
* Revert "fix(core): publish schedule completion events to connectors"
This reverts commit 0d64f037b9.
159 lines
4.8 KiB
Plaintext
159 lines
4.8 KiB
Plaintext
---
|
|
title: "Connectors"
|
|
sidebarTitle: "Connectors"
|
|
description: "Connect the CLI to Telegram, Slack, Discord, Google Chat, WhatsApp, etc."
|
|
---
|
|
<Warning>
|
|
This feature currently only applies to Cline CLI.
|
|
</Warning>
|
|
|
|
Connectors let you chat with your agent from messaging platforms. Each incoming message creates or continues an agent session, and the agent's response is sent back to the conversation.
|
|
|
|
## Setup Wizard
|
|
|
|
Run `cline connect` to open an interactive wizard that guides you through platform selection, credential entry, security configuration, and advanced options (provider, model, system prompt, agent mode).
|
|
|
|
```bash
|
|
cline connect
|
|
```
|
|
|
|
## Supported Platforms
|
|
|
|
| Platform | Direct Command | Required Credentials |
|
|
|----------|---------------|---------------------|
|
|
| Telegram | `cline connect telegram` | Bot token |
|
|
| Slack | `cline connect slack` | Bot token, signing secret, base URL |
|
|
| Discord | `cline connect discord` | Application ID, bot token, public key, base URL |
|
|
| Google Chat | `cline connect gchat` | Service account credentials JSON, base URL |
|
|
| WhatsApp | `cline connect whatsapp` | Phone number ID, access token, app secret, verify token, base URL |
|
|
| Linear | `cline connect linear` | API key, webhook signing secret, base URL |
|
|
|
|
## Telegram
|
|
|
|
<Steps>
|
|
<Step title="Create a Telegram bot">
|
|
Open Telegram and start a chat with [@BotFather](https://t.me/BotFather). Send `/newbot` and follow the prompts:
|
|
|
|
1. Enter a display name (e.g., "Cline")
|
|
2. Enter a username ending in `bot` (e.g., `cline_myname_bot`). Must be unique across Telegram.
|
|
3. BotFather responds with your bot token (looks like `7123456789:AAH...`)
|
|
</Step>
|
|
|
|
<Step title="Start the connector">
|
|
```bash
|
|
cline connect telegram -k <BOT-TOKEN>
|
|
```
|
|
|
|
The connector discovers the bot username from the token. Use `--bot-username` only if you need to override it.
|
|
</Step>
|
|
|
|
<Step title="Chat with your bot">
|
|
Open Telegram, search for your bot's username, and send a message. The agent processes it and replies in the chat.
|
|
</Step>
|
|
</Steps>
|
|
|
|
### Security
|
|
|
|
By default, anyone who finds your bot can message it and it will execute tasks on your machine. Lock it down with the `--hook-command` flag.
|
|
|
|
<Steps>
|
|
<Step title="Get your Telegram user ID">
|
|
Message [@userinfobot](https://t.me/userinfobot) on Telegram. It replies with your user ID immediately.
|
|
</Step>
|
|
|
|
<Step title="Start with access control">
|
|
Replace `12345` with your actual Telegram user ID:
|
|
|
|
```bash
|
|
cline connect telegram -k <BOT-TOKEN> \
|
|
--hook-command 'jq -r ".payload.actor.participantKey" | grep -q "telegram:id:12345" && echo "{\"action\":\"allow\"}" || echo "{\"action\":\"deny\",\"message\":\"unauthorized\"}"'
|
|
```
|
|
</Step>
|
|
</Steps>
|
|
|
|
The `--hook-command` receives each incoming message with sender info via stdin. Your script returns `{"action": "allow"}` or `{"action": "deny", "message": "reason"}`. Without `--hook-command`, everything is auto-approved.
|
|
|
|
## Slack
|
|
|
|
Requires a bot token, signing secret, and public base URL.
|
|
|
|
```bash
|
|
cline connect slack --token <BOT-TOKEN> --signing-secret <SECRET> --base-url <URL>
|
|
```
|
|
|
|
Each Slack thread maps to an agent session, so the agent maintains conversation context within a thread.
|
|
|
|
## Discord
|
|
|
|
Requires an application ID, bot token, public key, and public base URL.
|
|
|
|
```bash
|
|
cline connect discord --app-id <ID> --token <TOKEN> --public-key <KEY> --base-url <URL>
|
|
```
|
|
|
|
## Google Chat
|
|
|
|
Requires a service account credentials JSON file and public base URL.
|
|
|
|
```bash
|
|
cline connect gchat --credentials <JSON> --base-url <URL>
|
|
```
|
|
|
|
## WhatsApp
|
|
|
|
Requires a phone number ID, access token, app secret, webhook verify token, and public base URL.
|
|
|
|
```bash
|
|
cline connect whatsapp --phone-id <ID> --token <TOKEN> --app-secret <SECRET> --base-url <URL>
|
|
```
|
|
|
|
## Linear
|
|
|
|
Requires an API key, webhook signing secret, and public base URL.
|
|
|
|
```bash
|
|
cline connect linear --api-key <KEY> --signing-secret <SECRET> --base-url <URL>
|
|
```
|
|
|
|
## Managing Connectors
|
|
|
|
```bash
|
|
# Stop all connectors
|
|
cline connect --stop
|
|
|
|
# Stop a specific connector
|
|
cline connect telegram --stop
|
|
```
|
|
|
|
## Hook Command Protocol
|
|
|
|
The `--hook-command` pattern works across all connectors. The script receives a JSON payload via stdin:
|
|
|
|
```json
|
|
{
|
|
"payload": {
|
|
"actor": {
|
|
"participantKey": "telegram:id:12345",
|
|
"displayName": "User Name"
|
|
},
|
|
"message": "The incoming message text"
|
|
}
|
|
}
|
|
```
|
|
|
|
Return `{"action": "allow"}` or `{"action": "deny", "message": "reason"}`.
|
|
|
|
## Running Multiple Connectors
|
|
|
|
Multiple connectors can run simultaneously. They all share the same hub:
|
|
|
|
```bash
|
|
# Terminal 1
|
|
cline connect telegram -k $TELEGRAM_TOKEN
|
|
|
|
# Terminal 2
|
|
cline connect slack --token $SLACK_TOKEN --signing-secret $SECRET --base-url $URL
|
|
```
|
|
|
|
Connectors require the hub. Start it with `cline hub start` if it doesn't auto-start.
|