/api/v4/postsCrear una publicación de anuncio
Crea una publicación social de tipo ANNOUNCEMENT y la publica en los sitios elegidos para una o más ubicaciones.
Parámetros
Cuerpo
| Nombre | Tipo | Obligatorio | Descripción |
|---|---|---|---|
| input | object | obligatorio | Wrapper object. Every field below is a property of `input`, the entire body must be nested under it. |
| input.postName | string | obligatorio | Internal name for the campaign (not shown to customers). |
| input.locationIds | array of strings | obligatorio | Base64-encoded location IDs to publish to (e.g. `TG9jYXRpb246MTgwMDI4OQ==`). |
| input.postType | string | obligatorio | Must be `ANNOUNCEMENT`. One of EVENT, OFFER, ANNOUNCEMENT, COVID19, PRODUCT. |
| input.postSites | array of strings | obligatorio | Sites to publish to: `GOOGLE`, `FACEBOOK`. |
| input.postMessage | array of objects | opcional | Per-site body text: `{ site, message }`. Provide one entry per site in `postSites`. |
| input.postCta | array of objects | opcional | Optional call-to-action button per site: `{ site, type, url }`. `type` is one of BOOK, ORDER, SHOP, LEARN_MORE, SIGN_UP, GET_OFFER. |
| input.postMediaUrl | array of objects | opcional | Optional media per site: `{ site, url, type }` where `type` is IMAGE or VIDEO. |
| input.clientMutationId | string | opcional | Optional client token returned unchanged in the response for correlation. |
Solicitud de ejemplo
Cuerpo listo para pegar. Sustituye los ID y valores de ejemplo por los tuyos.
{ "input": { "postName": "Grand Opening Announcement", "locationIds": ["TG9jYXRpb246MTgwMDI4OQ=="], "postType": "ANNOUNCEMENT", "postSites": ["GOOGLE"], "postMessage": [ { "site": "GOOGLE", "message": "We are now open! Visit Jenny Home this week for our grand opening." } ], "postCta": [ { "site": "GOOGLE", "type": "LEARN_MORE", "url": "https://jennyhome.example/opening" } ], "postMediaUrl": [ { "site": "GOOGLE", "url": "https://cdn.example.com/opening.jpg", "type": "IMAGE" } ] }}Respuestas
200Post accepted. Publishing runs asynchronously, the returned post starts as INPROGRESS.
{ "data": { "createSocialPost": { "clientMutationId": null, "success": true, "errors": [], "socialPost": { "id": "U29jaWFsUG9zdDo0NDEyMg==", "name": "Grand Opening Announcement", "status": "INPROGRESS", "type": "ANNOUNCEMENT", "createdAt": "2026-06-28", "sites": ["GOOGLE"], "message": [ { "site": "GOOGLE", "message": "We are now open! Visit Jenny Home this week for our grand opening." } ], "cta": [ { "type": { "value": "LEARN_MORE", "label": "Learn more" }, "url": "https://jennyhome.example/opening", "site": "GOOGLE", "tinyUrl": null } ], "contextInfo": null, "mediaUrl": [ { "url": "https://cdn.example.com/opening.jpg", "site": "GOOGLE", "type": "IMAGE" } ], "publishDetails": [ { "site": "GOOGLE", "status": "PUBLISHING", "createdDate": "2026-06-28", "submissionError": null } ], "postLinks": [], "locationIds": [1800289] } } }}400Bad request, the body was not wrapped in `input` (error message: `Variable "$input" of required type "CreateSocialPostMutationInput!" was not provided`).
401Unauthenticated, missing or invalid API key.
Crea un anuncio: el tipo de publicación más sencillo. Un anuncio contiene un mensaje sencillo (y, opcionalmente, una CTA y una imagen), sin fechas de evento ni detalles de oferta. Pasa postType: "ANNOUNCEMENT" y una entrada postMessage por sitio en postSites.
Caso de uso: «Estamos abiertos» en tus establecimientos. Anuncia una gran inauguración o un nuevo horario en Google (y Facebook) para un conjunto de ubicaciones en una sola llamada. Proporciona una CTA de tipo LEARN_MORE que enlace a tu sitio y una imagen para crear una tarjeta más completa. La llamada devuelve inmediatamente status: INPROGRESS; consulta periódicamente GET /posts/{postId} con el socialPost.id devuelto hasta que indique SUCCESS, y consulta publishDetails[].submissionError si falla algún sitio.
Notas.
- El cuerpo de la solicitud debe estar envuelto en un objeto
input: cada campo (postName,locationIds,postType,postSites, …) es una propiedad deinput. Un cuerpo plano, sin envolver, se rechaza con un estado HTTP 400 (Variable "$input" of required type "CreateSocialPostMutationInput!" was not provided). postSitesy cadapostMessage.siteusan la enumeración de sitios (GOOGLE,FACEBOOK); proporciona una entrada de mensaje para cada sitio de destino.- Para publicar el mismo anuncio en muchas ubicaciones, pasa todos los ID en
locationIdsaquí, o usaPOST /bulk-postspara publicaciones a gran escala en múltiples ubicaciones. - Para publicaciones con fechas, usa eventos; para cupones o descuentos, usa ofertas.
Operación de escritura: no se ha ejecutado en la cuenta real. La solicitud y la respuesta mostradas se han generado a partir del esquema de la API; al ejecutarse, esta operación publica en perfiles reales de Google/Facebook.
curl -X POST 'https://listingsapi.com/api/v4/posts' \ -H "Authorization: API $LISTINGSAPI_KEY" \ -H 'Content-Type: application/json' \ -d '{ "input": { "postName": "Grand Opening Announcement", "locationIds": [ "TG9jYXRpb246MTgwMDI4OQ==" ], "postType": "ANNOUNCEMENT", "postSites": [ "GOOGLE" ], "postMessage": [ { "site": "GOOGLE", "message": "We are now open! Visit Jenny Home this week for our grand opening." } ], "postCta": [ { "site": "GOOGLE", "type": "LEARN_MORE", "url": "https://jennyhome.example/opening" } ], "postMediaUrl": [ { "site": "GOOGLE", "url": "https://cdn.example.com/opening.jpg", "type": "IMAGE" } ] } }'