Messages

Resolve message attachment

Changed on

Resolve one attachment on a message to a media url that works right now.

Instagram and Facebook sign DM media urls per request and expire them, so the url on a message is a snapshot: it works when you read the message and stops working later. This endpoint checks the stored url and, when it has gone stale, re-mints the message's media from Meta and persists it before answering. The message id never expires, so this URL is the one to store. It is returned ready-made on each attachment as refreshUrl when you read a message over REST.

Webhook payloads do not carry refreshUrl, so a webhook-driven integration builds this URL itself. Every piece is in the event: message.conversationId, message.platformMessageId, the attachment's zero-based position, and account.accountId. accountId is a required query parameter; omitting it returns 400 missing_required_field, which is the same requirement GET /v1/whatsapp/media/{mediaId} has.

By default it responds 302 to the live media url, so it can be used directly as an <img src> on a browser session. API-key integrators should pass ?format=json and read url off the body, since a browser cannot attach an Authorization header to an image request.

Only Instagram and Facebook media can be re-minted. On other platforms the stored url is returned as-is when it still resolves, and 404 otherwise.

get/v1/inbox/conversations/{conversationId}/messages/{messageId}/attachments/{index}

Request

  • Base URL: https://zernio.com/api
  • URL: https://zernio.com/api/v1/inbox/conversations/{conversationId}/messages/{messageId}/attachments/{index}
  • Auth: HTTP bearer

Path parameters

conversationIdstring required

The conversation ID (Zernio id or platform conversation id)

messageIdstring required

The message id as returned by the list-messages endpoint (the platform message id)

indexinteger required

Zero-based position of the attachment in the message's attachments array

Query parameters

accountIdstring required

Account ID. Required: without it the request returns 400 missing_required_field.

format'redirect' | 'json'

redirect (default) answers 302 to the media; json returns the url in the body

Response

Resolved url (only when format=json)

statusstring
urlstring

Live media url. Short-lived; re-request this endpoint rather than storing it.

refreshedboolean

True when the stored url had expired and was re-minted from the platform.

Example response

{
  "status": "success"
}

Changes

    • warning

      added the new account enum value to the / response property for the response status

    • warning

      added the new account enum value to the / response property for the response status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status