GuideAnleitungen/Rezepte/Publish a post

Diese Anleitung ist auf Englisch verfügbar.

How do I publish a Google Business Profile post through the API?

Publish a Google Business Profile Post via API

Publish an announcement, offer or event to a location's connected platforms, and handle the draft returned when a platform is not connected.

Auf einen Blick

Was diese Anleitung leistet
Publish or schedule a post to a location's connected platforms and handle missing connections.
Verwendete APIs
Referenz
Posts
Voraussetzungen
  • An API key with write access
  • The locationId, connected to at least one platform
Typische Anwendungsfälle
  • Pushing offers and announcements from your own scheduler
  • Publishing an event to Google Business Profile
  • Queueing a post for a future date

POST /api/v1/posts publishes an announcement, offer or event to a location's connected platforms, and by default it goes out the moment you call it. That is the first thing to get right: set scheduledFor or draft: true when you do not want it live immediately. One constraint to know up front, event and offer types are Google-only. The example below schedules a September offer to Google.

curl -X POST https://ai.synup.com/api/v1/posts \
  -H "Authorization: Bearer $SYNUP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "locationId": "LOCATION_ID",
    "name": "September whitening offer",
    "postType": "offer",
    "platforms": ["google"],
    "messageGoogle": "20% off teeth whitening this September. Book online.",
    "ctaType": "book",
    "ctaUrl": "https://grovestreetdental.example/book",
    "scheduledFor": "2026-09-01T09:00:00Z"
  }'
const API = "https://ai.synup.com/api/v1";
const headers = {
  Authorization: `Bearer ${process.env.SYNUP_API_KEY}`,
  "Content-Type": "application/json",
};

async function publishPost(locationId, post) {
  const res = await fetch(`${API}/posts`, {
    method: "POST",
    headers,
    body: JSON.stringify({ locationId, ...post }),
  });
  if (!res.ok) throw new Error(`${res.status}: ${(await res.json()).error}`);
  const { data } = await res.json();
  // data.status: draft | scheduled | active | error
  // data.missingPlatforms: platforms with no connection; data.missingFields: what a draft still needs
  return data;
}
import os
import requests

API = "https://ai.synup.com/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['SYNUP_API_KEY']}", "Content-Type": "application/json"}

def publish_post(location_id, post):
    r = requests.post(f"{API}/posts", headers=HEADERS, timeout=30,
                      json={"locationId": location_id, **post})
    r.raise_for_status()
    return r.json()["data"]  # status, missingPlatforms, missingFields

A platform with no active connection does not fail the call. The post is saved as a draft and the response names the missing platforms in missingPlatforms, so your UI can prompt the customer to connect. That is the case to handle: a 200 does not always mean the post is live. Read status, and treat draft with missingPlatforms as "connect Google first", not "done".

Posts are one of six local marketing features in the SaaS guide. To see whether a post moved the needle, retrieve profile analytics after it runs.