Oct 25, 2025

Automate: Replace Images in Google Slides (n8n)

Automate: Replace Images in Google Slides with n8n Updating images in presentation decks can be repetitive — especially when you need to replace logos, backgrounds, or screenshots across many slides. This tutorial shows how to build an n8n workflow that replaces images in Google Slides dynamically using a webhook and the Google Slides API. You’ll […]

Automate: Replace Images in Google Slides (n8n)

Automate: Replace Images in Google Slides with n8n

Updating images in presentation decks can be repetitive — especially when you need to replace logos, backgrounds, or screenshots across many slides. This tutorial shows how to build an n8n workflow that replaces images in Google Slides dynamically using a webhook and the Google Slides API. You’ll learn how to identify images by alt-text, call the Slides API to find image objectIds, and perform a batchUpdate to replace the image and update alt text.

Why automate image replacement in Google Slides?

Manually updating images in slides is error-prone and time-consuming. An automated solution gives you:

  • Speed — update many slides or decks in seconds
  • Consistency — replace images with exact positioning and crop behavior
  • Scalability — integrate with other systems (CMS, CRM, or marketing automation)

What this n8n workflow does

The workflow exposes a POST webhook endpoint that accepts a JSON payload. After validating the parameters it:

  • Retrieves the Google Slides presentation
  • Searches slides for page elements (images) that match the provided alt-text key
  • Uses the Slides API replaceImage request to swap the image URL and update alt text
  • Sends a Slack notification and returns a JSON success response

Prerequisites

  • An n8n instance (cloud or self-hosted)
  • Google Slides API credentials configured in n8n (OAuth2)
  • A Google Slides presentation with images that have unique alt-text identifiers
  • Optional: Slack workspace and channel for notifications

Workflow overview (nodes)

The workflow uses the following n8n nodes:

  • Webhook Trigger — listens for incoming POST requests
  • IF (Validate Parameters) — ensures presentation_id, image_key, and image_url exist
  • HTTP Request (Get Presentation Slides) — GET presentation via Slides API
  • Code (Find Image ObjectIds) — extract image pageElements that match alt-text
  • HTTP Request (Replace Image) — POST batchUpdate to replace the image and update alt text
  • Respond to Webhook — return success or error JSON to caller
  • Slack — send a notification of the change (optional)

Step-by-step guide

1. Add a unique identifier to images in Google Slides

Open your Google Slides deck, click an image, then Format Options > Alt text. Put a unique key such as client_logo or hero_background. The workflow searches by this alt-text value to find images to replace.

2. Create the webhook in n8n

In n8n add a Webhook Trigger node with POST and a path (for example: /replace-image-in-slide). Set the response mode to responseNode so you can return structured JSON responses from the workflow.

3. Validate incoming parameters

Use an IF node to ensure the body contains:

  • presentation_id — the ID from the presentation URL
  • image_key — the alt-text key you set on the image
  • image_url — the publicly accessible URL of the replacement image

4. Retrieve the presentation

Use the Google Slides HTTP Request node to GET the presentation JSON from the Slides API:

{
  "url": "https://slides.googleapis.com/v1/presentations/{{ $json.body.presentation_id }}",
  "method": "GET"
}

5. Find the image objectIds

Use a Code node to iterate the slides and pageElements. Filter elements where image exists and the element’s description (alt text) matches your image_key. Return an array of objects with objectId values.

6. Replace the image and update alt text

For each objectId found call the Slides API batchUpdate with a payload similar to:

{
  "requests": [
    {
      "replaceImage": {
        "imageObjectId": "OBJECT_ID_HERE",
        "url": "https://example.com/new-image.jpg",
        "imageReplaceMethod": "CENTER_CROP"
      }
    },
    {
      "updatePageElementAltText": {
        "objectId": "OBJECT_ID_HERE",
        "description": "your_image_key"
      }
    }
  ]
}

Notes:

  • imageReplaceMethod controls how the new image fits the existing element (CENTER_CROP, STRETCH, etc.).
  • Keep the objectId stable for both requests so the replacement and alt-text update target the same element.

Error handling and responses

If any required field is missing the workflow returns a 500 JSON response with an error message such as { "error": "Missing fields." }. On success it returns { "message": "Image replaced." } and posts a message to Slack (if configured).

Security and best practices

  • Make sure the replacement image URL is reachable by Google (publicly accessible or in a location Google can fetch).
  • Limit who can call the webhook — use an API key, IP allowlists, or n8n’s authentication options to avoid unauthorized changes.
  • Test on a copy of your presentation before running in production to avoid accidental data changes.
  • Use descriptive alt-text keys to prevent accidental replacements.

Example request body

{
  "presentation_id": "1A2b3C4d5Ef6G7h8I9J0k",
  "image_key": "client_logo",
  "image_url": "https://assets.example.com/logos/new-logo.png"
}

Troubleshooting tips

  • If objectIds are not found, confirm that the image’s Alt text exactly matches the provided image_key.
  • If Google returns permission errors, re-check OAuth scopes for the Slides API in your Google Cloud Console and in the n8n credential setup.
  • If the image does not display correctly after replacement, try a different imageReplaceMethod like STRETCH or upload an image with similar proportions.

Next steps and integrations

You can expand this workflow to pull images from a CMS, generate images dynamically (for example from a design API), or trigger replacements based on events in a CRM. Combine with version control or audit logging if you need traceability for presentation changes.

Call to action

Ready to automate your slide updates? Import this workflow into n8n, connect your Google Slides credentials, and test with a sample presentation. Subscribe for more n8n automation tutorials and get a free workflow template delivered to your inbox.

If you’d like, I can generate a downloadable n8n workflow JSON adapted to your exact use-case — tell me whether you want Slack notifications enabled and which imageReplaceMethod you prefer.

Leave a Reply

Your email address will not be published. Required fields are marked *