Image URLs

Overview

An Embedded Messaging message's media value is either a relative path or an absolute URL. A relative path means the image was uploaded to the Optimove media library; prefix it with your region's image CDN base URL before you display it. An absolute URL means the image is hosted elsewhere; use it as returned.

This applies to messages you read through the Web SDK data API and through the Embedded Messaging REST API.

Regional Base URLs

Use the base URL for the region your Optimove account is hosted in. Resized images come from the image resizer; original images come from the media CDN.

RegionResized images (364 × 180)Original images
EUhttps://i-eu-central-2.app.delivery/364x180/https://media-cdn-eu-central-2.app.delivery/
UShttps://i-us-east-1.app.delivery/364x180/https://media-cdn-us-east-1.app.delivery/

If you are not sure which region your account uses, ask your Optimove Customer Success Manager.

Building the Full Image URL

Join the base URL and the returned path with exactly one slash between them. Strip any trailing slash from the base URL and any leading slash from the path first, so you never get // or a missing separator.

Example for an EU account:

PartValue
Base URLhttps://i-eu-central-2.app.delivery/364x180/
Returned pathfolder/image.png
Full URLhttps://i-eu-central-2.app.delivery/364x180/folder/image.png
const IMAGE_BASE_URL = 'https://i-eu-central-2.app.delivery/364x180'; // or the US URL

function resolveImageUrl(path) {
  if (!path) return '';
  // Externally hosted images arrive as absolute URLs: use them as returned.
  if (/^https?:\/\//i.test(path)) return path;
  return IMAGE_BASE_URL.replace(/\/+$/, '') + '/' + path.replace(/^\/+/, '');
}

resolveImageUrl('folder/image.png');
// https://i-eu-central-2.app.delivery/364x180/folder/image.png

Changing the Resize Dimensions

The size segment of the resizer URL is <width>x<height>, in pixels. Replace 364x180 with the size your layout needs. Use fit as the height to scale to the width and keep the image's aspect ratio.

Size segmentResultExample
364x180364 × 180 px (the default Embedded Messaging card)https://i-eu-central-2.app.delivery/364x180/folder/image.png
728x360728 × 360 px, for high-density screenshttps://i-eu-central-2.app.delivery/728x360/folder/image.png
150xfit150 px wide, height to matchhttps://i-eu-central-2.app.delivery/150xfit/folder/image.png

Original Images

To show an image at its uploaded size, use the media CDN instead of the resizer. There is no size segment; append the path straight after the host.

  • EU: https://media-cdn-eu-central-2.app.delivery/folder/image.png
  • US: https://media-cdn-us-east-1.app.delivery/folder/image.png
💡

Use the original URL for GIFs. The Optimove SDK serves GIFs from the media CDN rather than the resizer, so animation is preserved.

Externally Hosted Images

If the image URL starts with https:// or http://, the image is hosted outside Optimove. Use it exactly as returned: do not add a base URL or a size segment, because external images cannot be resized by Optimove.

SDK Data API and REST API

Both APIs return the image exactly as it is stored: a relative path for media-library images, an absolute URL for external images. Neither adds the base URL for you, so apply the steps above in either case.

const response = await optimoveSDK.API.embeddedMessaging.getMessagesAsync([{ containerId: 'home' }]);

response.home.messages.forEach((message) => {
  const src = resolveImageUrl(message.media); // from "Building the Full Image URL"
  // render <img src={src}> in your own frontend
});
📘

The Optimove SDK's built-in Inbox UI resolves image URLs itself; you need these steps only when you render messages in your own frontend.

APICallImage field
Web SDK data APIoptimoveSDK.API.embeddedMessaging.getMessagesAsync([{ containerId: 'home' }])media on each message in response[containerId].messages
REST APIPOST <INBOX_HOST>/api/v2/embedded-messages/getmedia on each message in containers[containerId]

For the full endpoint reference, see Get Embedded Messages.


Did this page help you?