OverviewProductsPlatformsAPI ReferenceResources

Posts & content types

Create a Google Business Profile post with an image, add a call-to-action button, publish text only and edit a published post.


By the end of this page, you have published a post with an image to Google Business Profile (googlebusiness) with POST /v1/posts. You have also added a call-to-action button and edited a published post with POST /v1/posts/{postId}/edit.

Before you start

You need an API key and a connected Google Business Profile account (accountId, from the Google Business Profile page).

Step 1: create a post with an image

Call POST /v1/posts (Create post) with:

  • content
  • one image in mediaItems
  • a platforms entry with platform: "googlebusiness"
  • publishNow: true

With no topicType the post is a STANDARD update.

To schedule instead, replace publishNow with scheduledFor and timezone. The post lifecycle guide covers the statuses.

TypeScript
import Zernio from '@zernio/node';

const zernio = new Zernio();

const { data: published } = await zernio.posts.createPost({
  body: {
    content: 'Open all holiday weekend. Stop by for the seasonal menu.',
    mediaItems: [
      { type: 'image', url: 'https://cdn.example.com/holiday-special.jpg' }
    ],
    platforms: [
      { platform: 'googlebusiness', accountId: '66b2e19d8c3f5a7e9d0b1c2d' }
    ],
    publishNow: true
  }
});

console.log(published.post.platforms[0].platformPostUrl);

Response (201):

JSON
{
  "post": {
    "_id": "65f1c0a9e2b5af0012ab34cd",
    "status": "published",
    "platforms": [
      {
        "platform": "googlebusiness",
        "status": "published",
        "platformPostId": "1234567890123456789",
        "platformPostUrl": "https://business.google.com/..."
      }
    ]
  }
}

Omit mediaItems for a text-only post. A post carries at most 1 image and no video.

Every sample below changes only the platforms entry of this request and returns the same response.

Step 2: add a call-to-action button

Set platformSpecificData.callToAction with a type and an HTTPS url. The button appears under the post.

JSON
{
  "platform": "googlebusiness",
  "accountId": "66b2e19d8c3f5a7e9d0b1c2d",
  "platformSpecificData": {
    "callToAction": { "type": "BOOK", "url": "https://mybusiness.com/book" }
  }
}
typeButtonTypical use
LEARN_MORELink to more informationArticles, about pages
BOOKBooking or reservation linkServices, appointments
ORDEROnline ordering linkRestaurants, food
SHOPE-commerce linkRetail, products
SIGN_UPRegistration linkEvents, newsletters
CALLPhone callContact, inquiries

Event and offer posts add topicType and an event or offer object on top of this. See Event & Offer Posts.

Step 3: edit a published post

Call POST /v1/posts/{postId}/edit with platform: "googlebusiness" and the new content (Edit post).

Only the post body changes. To change the image, publish a new post.

For every post type, these stay as published: the call to action, the event title and schedule, the offer fields and the image.

There is no time window and no edit limit, and the post keeps its id.

id in the response is Google's post id, the platformPostId from Step 1. It is not the Zernio _id you pass in the path.

TypeScript
const { data: edited } = await zernio.posts.editPost({
  path: { postId: '65f1c0a9e2b5af0012ab34cd' },
  body: {
    platform: 'googlebusiness',
    content: 'Open all holiday weekend, 8am to 8pm. Stop by for the seasonal menu.'
  }
});

console.log(edited.id, edited.url);

Response (200):

JSON
{
  "success": true,
  "id": "1234567890123456789",
  "url": "https://business.google.com/...",
  "message": "googlebusiness post edited successfully"
}

Two accounts. If the post went to two connected accounts, pass accountId in the body to pick which one to edit.

Several locations. accountId selects the account, not the location. A post fanned out to several locations from one account always edits that account's first entry.

If it fails

A 404 on POST /v1/posts/{postId}/edit means the post no longer exists on Google. Either it was deleted from the Business Profile dashboard, or it is an EVENT or OFFER post whose end date has passed.

JSON
{
  "error": "Not found",
  "type": "not_found"
}

Publish a new post instead; the edit cannot be retried.

Error handling covers the envelope, and Fields, Media & Limits lists the publishing errors.

Was this page helpful?

On this page