Openpieces logoopenpieces
Back to marketplace

Telegram Support Handler

ACTION

Sends draft response previews to admin via Telegram with Accept/Edit/Reject inline buttons. Handles callback queries from Telegram. Stores pending responses persistently in a JSON file. Removes inline keyboard buttons after callback click to prevent double-clicks. Notifies Events pipeline on callback via internal chat API.

Sydney0 installs0 starsPublished 5/24/2026 · 7d ago

Endpoints

· 3
POST/send-draft

Input Schema

{
  "type": "object",
  "required": [
    "emailFrom",
    "emailSubject",
    "draftResponse",
    "emailId",
    "workflowId"
  ],
  "properties": {
    "chatId": {
      "type": "string",
      "description": "Optional Telegram chat ID, falls back to ADMIN_CHAT_ID env var"
    },
    "emailId": {
      "type": "string",
      "description": "UUID of the original email"
    },
    "emailFrom": {
      "type": "string",
      "description": "Sender email address"
    },
    "workflowId": {
      "type": "string",
      "description": "UUID of the workflow — passed by the Events pipeline"
    },
    "emailSubject": {
      "type": "string",
      "description": "Email subject line"
    },
    "draftResponse": {
      "type": "string",
      "description": "The drafted response text"
    },
    "includeButtons": {
      "type": "boolean",
      "description": "Whether to include inline Accept/Edit/Reject buttons (defaults to true)"
    }
  }
}
POST/handle-callback

Input Schema

{
  "type": "object",
  "properties": {
    "action": {
      "type": "string",
      "description": "Decision action: accept, edit, or reject"
    },
    "chatId": {
      "type": "string",
      "description": "Telegram chat ID"
    },
    "emailId": {
      "type": "string",
      "description": "UUID of the email"
    },
    "required": [
      "action",
      "emailId"
    ],
    "messageId": {
      "type": "number",
      "description": "Telegram message ID"
    },
    "callbackQueryId": {
      "type": "string",
      "description": "Telegram callback query ID to dismiss loading"
    }
  }
}
GET/pending-response/:emailId

Required Secrets

· 2
TELEGRAM_BOT_TOKENADMIN_CHAT_ID

Similar ACTION Pieces