/api/v4/postsCriar uma publicação de evento
Cria uma publicação social do tipo EVENT com um título e um período de início e término, publicada nos sites escolhidos para um ou mais locais.
Parâmetros
Corpo
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
| input | object | obrigatório | Wrapper object. Every field below is a property of `input`, the entire body must be nested under it. |
| input.postName | string | obrigatório | Internal name for the campaign (not shown to customers). |
| input.locationIds | array of strings | obrigatório | Base64-encoded location IDs to publish to (e.g. `TG9jYXRpb246MTgwMDI4OQ==`). |
| input.postType | string | obrigatório | Must be `EVENT`. One of EVENT, OFFER, ANNOUNCEMENT, COVID19, PRODUCT. |
| input.postSites | array of strings | obrigatório | Sites to publish to: `GOOGLE`, `FACEBOOK`. |
| input.postContextInfo | object | opcional | Event details: `{ title, startDay, startTime, endDay, endTime }`. `title` is required by Google for events; `startDay`/`endDay` are dates, `startTime`/`endTime` are display strings like `10:00am`. |
| input.postMessage | array of objects | opcional | Per-site body text: `{ site, message }`. One entry per site in `postSites`. |
| input.postScheduledDates | object | opcional | When to publish/expire the post itself: `{ startDatetime, endDatetime, removalSites }`. Distinct from the event's own dates in `postContextInfo`. |
| input.postCta | array of objects | opcional | Optional call-to-action 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. |
Exemplo de requisição
Corpo pronto para colar. Substitua os IDs e valores de exemplo pelos seus.
{ "input": { "postName": "Summer Sale Kickoff Event", "locationIds": ["TG9jYXRpb246MTgwMDI4OQ=="], "postType": "EVENT", "postSites": ["GOOGLE"], "postContextInfo": { "title": "Summer Sale Kickoff", "startDay": "2026-07-15", "startTime": "10:00am", "endDay": "2026-07-15", "endTime": "06:00pm" }, "postMessage": [ { "site": "GOOGLE", "message": "Join us for the Summer Sale kickoff, refreshments, giveaways, and up to 40% off in store." } ], "postCta": [ { "site": "GOOGLE", "type": "LEARN_MORE", "url": "https://jennyhome.example/summer-event" } ], "postMediaUrl": [ { "site": "GOOGLE", "url": "https://cdn.example.com/summer-event.jpg", "type": "IMAGE" } ] }}Respostas
200Post accepted. Publishing runs asynchronously, the returned post starts as INPROGRESS.
{ "data": { "createSocialPost": { "clientMutationId": null, "success": true, "errors": [], "socialPost": { "id": "U29jaWFsUG9zdDo0NDEyMw==", "name": "Summer Sale Kickoff Event", "status": "INPROGRESS", "type": "EVENT", "createdAt": "2026-07-01", "scheduledStartDate": "2026-07-15", "scheduledEndDate": "2026-07-15", "sites": ["GOOGLE"], "message": [ { "site": "GOOGLE", "message": "Join us for the Summer Sale kickoff, refreshments, giveaways, and up to 40% off in store." } ], "cta": [ { "type": { "value": "LEARN_MORE", "label": "Learn more" }, "url": "https://jennyhome.example/summer-event", "site": "GOOGLE", "tinyUrl": null } ], "contextInfo": { "title": "Summer Sale Kickoff", "startDay": "2026-07-15", "startTime": "10:00am", "endDay": "2026-07-15", "endTime": "06:00pm", "couponCode": null, "redeemUrl": null, "termsConditions": null, "discount": null, "locationType": null }, "mediaUrl": [ { "url": "https://cdn.example.com/summer-event.jpg", "site": "GOOGLE", "type": "IMAGE" } ], "publishDetails": [ { "site": "GOOGLE", "status": "PUBLISHING", "createdDate": "2026-07-01", "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.
Cria uma publicação de evento: um anúncio com data, um title e um período de início e término, exibido como um cartão de evento no Google. A programação do próprio evento fica em postContextInfo (title, startDay, startTime, endDay, endTime); o campo opcional postScheduledDates controla quando a própria publicação é publicada e retirada, período que geralmente antecede o evento.
Caso de uso: promover um evento na loja. Anuncie uma "Abertura da promoção de verão" para a Jenny Home, com o período do evento em 15 de julho e uma chamada para ação LEARN_MORE que leva à página do evento. Defina postType: "EVENT" e preencha postContextInfo.title, pois o Google rejeita eventos sem título. A chamada retorna status: INPROGRESS; confirme com GET /posts/{postId} que a publicação atinge SUCCESS.
Observações.
- O corpo da requisição deve estar encapsulado em um objeto
input: cada campo é uma propriedade deinput. Um corpo sem esse encapsulamento é rejeitado com o status HTTP 400 (Variable "$input" of required type "CreateSocialPostMutationInput!" was not provided). postContextInfocontém as datas do evento;postScheduledDatescontém as datas de publicação. UsepostScheduledDates.startDatetime/endDatetimepara agendar a publicação com antecedência e fazê-la expirar automaticamente após o evento.- Forneça uma entrada
postMessagepara cada site empostSites. - Para uma mensagem simples sem datas, use anúncios; para cupons/descontos, use ofertas.
Operação de escrita: não executada na conta real. A requisição e a resposta exibidas são construídas a partir do esquema da API; quando executada, esta operação publica em perfis reais do Google/Facebook.
curl -X POST 'https://listingsapi.com/api/v4/posts' \ -H "Authorization: API $LISTINGSAPI_KEY" \ -H 'Content-Type: application/json' \ -d '{ "input": { "postName": "Summer Sale Kickoff Event", "locationIds": [ "TG9jYXRpb246MTgwMDI4OQ==" ], "postType": "EVENT", "postSites": [ "GOOGLE" ], "postContextInfo": { "title": "Summer Sale Kickoff", "startDay": "2026-07-15", "startTime": "10:00am", "endDay": "2026-07-15", "endTime": "06:00pm" }, "postMessage": [ { "site": "GOOGLE", "message": "Join us for the Summer Sale kickoff, refreshments, giveaways, and up to 40% off in store." } ], "postCta": [ { "site": "GOOGLE", "type": "LEARN_MORE", "url": "https://jennyhome.example/summer-event" } ], "postMediaUrl": [ { "site": "GOOGLE", "url": "https://cdn.example.com/summer-event.jpg", "type": "IMAGE" } ] } }'