---
title: "phone-approve"
url: "https://claudemods.dev/zh-cn/builds/phone-approve-0546c2"
source: "https://github.com/ShriD5/claude-mods/tree/main/phone-approve"
source_type: "github"
repo: "https://github.com/ShriD5/claude-mods/tree/main/phone-approve"
author: "ShriD5"
author_handle: "ShriD5"
stars: 2
category: "通知与提醒"
categories: ["notifications"]
tags: ["hooks", "permission-prompts", "phone-approval", "remote-approval", "telegram"]
permission_level: 3
scan_complete: true
install: "claude plugin marketplace add ShriD5/claude-mods\nclaude plugin install phone-approve"
added: "2026-10-05T15:42:14.031Z"
updated: "2026-10-04T18:19:52Z"
locale: "zh-cn"
content_locale: "zh-cn"
---

# phone-approve

通过 Telegram 批准 Claude Code 的权限提示，并以终端提示作为后备方案。

## Description

通过手机批准 Claude Code 的权限提示。当 Claude Code 即将询问是否可以运行某个工具时，请求会发送到 Telegram，并带有 ✅ 批准和 ❌ 拒绝按钮；你的点击决定结果。

- 只有真正的提示会发送到手机。你的规则、模式或设置钩子已经允许或拒绝的内容不会到达 Telegram。
- 消息会说明具体请求：Bash 命令、正在写入或编辑的文件、URL，或其他工具的输入。
- 如果手机在超时前没有回应，由正常的终端提示作决定，Telegram 消息也会说明这一点。
- 如果你先在终端回答，插件会停止等待，并把消息编辑为“已在终端回答”。
- 等待期间，状态行显示 📱 等待手机…

## 安装

```sh
claude --plugin-dir ./phone-approve
```

或者把这个仓库加入 marketplace，再用 `/plugin` 添加。

## 设置

1. 给 @BotFather 发消息，发送 `/newbot`，然后复制 token。**请使用专用 bot。** 插件通过 `getUpdates` 读取按钮点击；Telegram 在 bot 设置了 webhook 时会拒绝它，而两个程序轮询同一个 bot 会互相抢走更新。
2. 给新 bot 发送任意消息，然后打开 `https://api.telegram.org/bot<token>/getUpdates`，复制 `message.chat.id`。这就是你的 chat id。
3. 保存这两项（token 会存入安全存储，而不是 settings.json）：

   ```sh
   echo '{"botToken":"123456:ABC…","chatId":"987654321"}' | claude plugin configure phone-approve --values-stdin
   ```

## 选项

| 选项 | 默认值 | 作用 |
| --- | --- | --- |
| `botToken` |（无）| bot 的 token。它被标记为敏感信息，因此会保存到安全存储中，绝不会记录日志。 |
| `chatId` |（无）| 请求发送到哪里。其他 chat 的点击会被忽略。 |
| `timeoutSeconds` | `120` | 在终端提示作决定前等待手机的时长。 |

插件在设置 `botToken` 和 `chatId` 之前不会执行任何操作。

## 工作原理

它挂接 `classic.PermissionRequest`，这是 Claude Code 即将询问你时发出的事件。插件通过 `$.http.fetch` 发送请求，然后长轮询 `getUpdates`，等待携带该请求一次性 nonce 的按钮点击。如果在规定时间内没有返回，就执行 `next(e)`，由终端提示作决定。

## Install

```
claude plugin marketplace add ShriD5/claude-mods
claude plugin install phone-approve
```

## Original README

# phone-approve

Approve Claude Code's permission prompts from your phone. When Claude Code is about to ask you whether it may run a tool, the request goes to Telegram with **✅ Approve** and **❌ Deny** buttons, and your tap decides it. Walk away from the desk and keep a long task moving.

- Only a real prompt goes to the phone. Anything your rules, mode or settings hooks already allow or deny never reaches Telegram.
- The message says what is asked: the Bash command, the file being written or edited, the URL, or the tool's input for anything else.
- If the phone doesn't answer within the timeout, the normal terminal prompt decides, and the Telegram message says so.
- If you answer in the terminal first, the plugin stops waiting and edits the message to "answered in the terminal".
- While it waits, the status line shows `📱 waiting for phone…`.

## Install

```sh
claude --plugin-dir ./phone-approve
```

or add this repo as a marketplace and install it with `/plugin`.

## Setup

1. Message [@BotFather](https://t.me/BotFather), send `/newbot`, and copy the token. **Use a dedicated bot.** The plugin reads button presses with `getUpdates`, which Telegram refuses while a bot has a webhook set, and two programs polling one bot steal each other's updates.
2. Send your new bot any message, then open `https://api.telegram.org/bot<token>/getUpdates` and copy `message.chat.id`. That's your chat id.
3. Save both (the token goes to secure storage, not settings.json):

   ```sh
   echo '{"botToken":"123456:ABC…","chatId":"987654321"}' | claude plugin configure phone-approve --values-stdin
   ```

## Options

| Option | Default | What it does |
| --- | --- | --- |
| `botToken` | (none) | The bot's token. Marked sensitive, so it's kept in secure storage and never logged. |
| `chatId` | (none) | Where requests go. Presses from any other chat are ignored. |
| `timeoutSeconds` | `120` | How long to wait for the phone before the terminal prompt decides. |

The plugin does nothing until `botToken` and `chatId` are set.

## How it works

It hooks `classic.PermissionRequest`, which Claude Code raises when it is about to ask you. It sends the request with `$.http.fetch`, then long-polls `getUpdates` for the button press carrying that request's one-time nonce. If nothing comes back in time, it returns `next(e)` so the terminal prompt decides.
