配置 Telegram 自定义通知

要在 Telegram 中设置来自 Crowdin 的自定义通知,请按照以下步骤操作。

创建 Telegram 账户

如果您没有预先注册 Telegram 账号,您需要连接一个电话号码。 Telegram 使用您的电话号码作为首要凭据,您将使用它登录 Telegram 账号。 首先,使用 AndroidiOS 手机下载和安装 Telegram 应用。 注册后,您可以使用 PC 或 Mac 提供的 Telegram 网页接口 来进一步配置,这部分由您自己决定。

创建 Telegram 机器人

要在 Telegram 中接收通知,您需要创建机器人。

阅读更多 创建一个 Telegram 机器人 的内容。

一旦完成,您将获得一个机器人 API 令牌。 请务必保存好令牌,稍后会需要它。

配置 Telegram 频道

下一步是创建一个公共 Telegram 频道,用于从 Crowdin 获取通知。 稍后您将可以 更改频道的隐私设置,如果必要的话。

要创建一个 Telegram 频道,请遵循以下步骤:

  1. 在您的设备上打开 Telegram。
  2. 点击”笔”图标并选择 新建频道
  3. 频道名称 字段中给您的频道起个名字。
  4. (可选) 指定一个频道描述。
  5. (可选) 点击相机图标为您的频道设置一个显示图片。
  6. 单击右上角的 下一步
  7. 选择 公共 频道类型。
  8. 为您的频道指定永久链接。 别人搜索和加入到您的频道中将需要这个链接。
  9. 单击右上角的 下一步
  10. (Optional) In this step, Telegram will ask you to add subscribers to your Telegram channel. Select contacts you’d like to add, including your new bot (provide your bot with Admin permissions). You can choose not to add any members for now since you’ll be able to do it later.
  11. Click Next in the top-right corner to continue and create your channel on Telegram.

在 Crowdin 中配置自定义通知频道

  1. 打开您的 账号设置 并前往 通知 选项卡。
  2. 点击设置通知自定义渠道
  3. In the appeared dialog, specify the URL in the following format:

    https://api.telegram.org/bot{bot_API_token}/sendMessage

    Note: Make sure to replace {bot_API_token} with your actual Telegram bot API token.
  4. Select application/json for the Content type.
  5. 将以下有效负载粘贴到有效负载字段中:

     {
         "chat_id": "{public_chat_id}",
         "text": "{{notification-message}}"
     }
    

    where {public_chat_id} – Your public chat id you specified for your channel link during the Telegram channel configuration.

  6. Click Test notification to receive a test message from Crowdin to your Telegram channel.
  7. 配置完成后,点击保存

更改 Telegram 频道类型

If you’d like to make your Telegram channel private and keep receiving notifications from Crowdin, follow these steps:

  1. First of all you need to acquire your Telegram channel’s original chat id by visiting: https://api.telegram.org/bot{bot_API_token}/sendMessage?chat_id={public_chat_id}&text=Test

    Note: Make sure to replace {bot_API_token} and {public_chat_id} with your actual Telegram bot API token and public chat id.
  2. You’ll get a response in a JSON format that will contain your Telegram channel’s original chat id. JSON response

  3. In Crowdin, open your Account Settings and go to the Notifications tab.
  4. 点击设置通知自定义渠道
  5. In the appeared dialog, modify the URL by replacing the chat id with the one received in the JSON response above.
  6. 点击 保存
  7. In Telegram, open your channel.
  8. Click on your channel name and click Edit.
  9. Click Channel Type.
  10. Select Private and click Done.

另请参阅

本文是否有帮助?