---
title: "Edit message (Telegram only)"
method: PATCH
path: "/api/messages/{id}"
tags: ["Direct Messages"]
---

# Edit message (Telegram only)

`PATCH /api/messages/{id}`

## Request

- Base URL: `https://api.postproxy.dev`
- URL: `https://api.postproxy.dev/api/messages/{id}`
- Auth: HTTP bearer

Edit a previously-sent outbound message on the platform. Telegram only — calling this on a non-Telegram message returns 422. Edits update both the platform-side message and the Postproxy record; external_edited_at is set and a message.edited webhook fires.

## Query parameters

- `profile_group_id` string

## Headers

- `Idempotency-Key` string

## Request body

- DmMessageEditRequest: Payload for editing an outbound Telegram message. At least one of body / reply_markup is required.
  - `body` string: New text. For media messages this becomes the new caption.
  - `reply_markup` object: New inline keyboard (or other reply_markup). Pass an empty {} to remove the existing keyboard.

## Response `200`

The updated message with external_edited_at set.

- DmMessage: A direct message (inbound or outbound) in a chat.
  - `id` string: Message hashid
  - `chat_id` string: Chat hashid
  - `external_id` string, nullable: Platform-native message ID (null while pending)
  - `direction` 'inbound' | 'outbound'
  - `body` string, nullable: Message text
  - `status` 'pending' | 'published' | 'failed_waiting_for_retry' | 'failed' | 'received': pending/published/failed_waiting_for_retry/failed for outbound, received for inbound
  - `external_comment_id` string, nullable: Set when the message was sent as a private reply to a comment
  - `error_message` string, nullable: Last error from the platform (when failed)
  - `error_details` PlatformErrorDetails, nullable: Structured platform error (omitted when no platform error info is available).
    - `platform_error_code` string, nullable: Error code returned by the platform API
    - `platform_error_subcode` string, nullable: Error subcode returned by the platform API
    - `platform_error_message` string, nullable: Error message returned by the platform API
    - `postproxy_note` string, nullable: Additional context from Postproxy about the error
  - `platform_data` object, nullable: Raw platform webhook payload, passed through unchanged. Shape is platform- and event-specific and may change without notice — prefer the typed fields where available.
  - `story_reply` object, nullable: Instagram only. Set on inbound messages that reply to one of your stories. The url is a short-lived Meta link tied to the story's lifetime (typically 24h or less) — not mirrored to Postproxy storage.
    - `id` string: Story asset id
    - `url` string: Meta lookaside CDN URL
  - `external_posted_at` string, nullable: ISO 8601 timestamp from the platform
  - `external_delivered_at` string, nullable: When the platform confirmed delivery (outbound; FB & IG only)
  - `external_read_at` string, nullable: When the recipient read the message (outbound; FB & IG only)
  - `external_edited_at` string, nullable: ISO 8601 timestamp of the most recent edit; body reflects the latest edit
  - `reply_to_external_id` string, nullable: Platform message ID this message replies to (inbound replies, outbound reply_to_external_id, or a Telegram callback query's source)
  - `reply_markup` object, nullable: Telegram only — the reply_markup attached to the message
  - `quick_replies` DmQuickReply[], nullable: Facebook and Instagram only — the chips sent with the message
    - `title` string, required: Required, 20 characters or fewer
    - `payload` string, required: Required, 1000 characters or fewer
    - `content_type` 'text': Optional; only "text" is accepted — Messenger's user_phone_number / user_email chips are not supported
  - `buttons` DmButton[], nullable: Facebook and Instagram only — the buttons attached to the message
    - `type` 'web_url' | 'postback', required
    - `title` string, required: Required, 20 characters or fewer
    - `payload` string: Required for postback buttons, 1000 characters or fewer
    - `url` string: Required for web_url buttons, must be an https:// URL
  - `card` object, nullable: Facebook and Instagram only — the card fields (subtitle, image_url, default_action) sent alongside buttons
  - `elements` DmCarouselElement[], nullable: Facebook and Instagram only - the normalized carousel cards sent with elements
    - `title` string, required
    - `subtitle` string
    - `image_url` string: Must be an https:// URL
    - `default_action` object: Action when the card itself is tapped
      - `type` 'web_url'
      - `url` string: Must be an https:// URL
    - `buttons` DmButton[]: Up to 3 buttons, same shape as DmButton
      - `type` 'web_url' | 'postback', required
      - `title` string, required: Required, 20 characters or fewer
      - `payload` string: Required for postback buttons, 1000 characters or fewer
      - `url` string: Required for web_url buttons, must be an https:// URL
  - `tapped_action` DmTappedAction, nullable: Set on inbound messages created by a tap of a quick reply, button postback, ice breaker, or Telegram inline-keyboard button. A tap also opens the 24-hour messaging window.
    - `kind` 'quick_reply' | 'postback' | 'callback_query': quick_reply, postback (Meta buttons and ice breakers), or callback_query (Telegram inline keyboards)
    - `payload` string
    - `title` string
  - `external_deleted_at` string, nullable: When the message was deleted/unsent on the platform (treat as redacted)
  - `reactions` DmReaction[]: Reactions on the message. Reflects the live state.
    - `sender_external_id` string
    - `emoji` string
    - `reaction` string
    - `at` string
  - `attachments` DmMessageAttachment[]: Media attached to the message
    - `id` string: Attachment hashid
    - `type` 'image' | 'video' | 'audio' | 'sticker' | 'file' | 'story_mention'
    - `url` string, nullable: Stable storage URL. While status is pending this may temporarily fall back to the source URL.
    - `status` 'pending' | 'processed' | 'failed'
    - `external_id` string, nullable: Platform-side identifier (e.g. a Messenger sticker ID), when provided
  - `is_unsupported` boolean: true when the platform marked the message as unsupported (e.g. an unprocessable voice clip)
  - `created_at` string: ISO 8601 timestamp of record creation
  - `template` object, nullable: WhatsApp only. The template a message was sent with — id, external_id, name, language, variables.
  - `interactive` object, nullable: WhatsApp only. Outbound: the interactive object sent. Inbound: the customer’s reply to one — type "button_reply" / "list_reply" / "nfm_reply" with the id and title you assigned.
  - `location` object, nullable: WhatsApp only. latitude, longitude, name, address — sent or received.
  - `source` string, nullable: "synced" on an outbound WhatsApp message the team sent from the phone on a coexistence number.

## Other responses

- `400`: Missing required parameters.
- `401`: Invalid, missing, or insufficient API key permissions.
- `404`: Resource does not exist or is not accessible.
- `422`: Validation failed.

---

[API](https://skmtc.dev/postproxy/apis/postproxy-social-media-api.md) - [All operations](https://skmtc.dev/postproxy/apis/postproxy-social-media-api/llms.txt) - [OpenAPI document](https://skmtc.dev/postproxy/apis/postproxy-social-media-api/revisions/d54482ac4ce7?raw)
