Adding Google API index code

Hi, can anyone help pls. I have a job recruitment agency who need to ensure their google sitemap indexing is updated every time a job vacancy is posted through the cms and thus when one is deleted. I have generated the code but no idea where to add it in my project? Anyone help.

String scopes = “https://www.googleapis.com/auth/indexing”;

String endPoint = “https://indexing.googleapis.com/v3/urlNotifications:publish”;

JsonFactory jsonFactory = new JacksonFactory();

// service_account_file.json is the private key that you created for your service account.

InputStream in = IOUtils.toInputStream(“bcb965bd0287331cd3665342dbf959345a7d8d6a.json”);

GoogleCredential credentials =

GoogleCredential.fromStream(in, this.httpTransport, jsonFactory).createScoped(Collections.singleton(scopes));

GenericUrl genericUrl = new GenericUrl(endPoint);

HttpRequestFactory requestFactory = this.httpTransport.createRequestFactory();

// Define content here. The structure of the content is described in the next step.

String content = “{”

HttpRequest request =

requestFactory.buildPostRequest(genericUrl, ByteArrayContent.fromString(“application/json”, content));

credentials.initialize(request);

HttpResponse response = request.execute();

int statusCode = response.getStatusCode();

Here is a getting started doc with Google JS API.

\Are you publishing the listings to your site with the Webflow API?

Hi, sorry for late reply, the client is simply using updating and creating job vacancies through the webflow cms.

@Andre1 - The question is how will you trigger the script? What event can you hook into?

Anyone have a solution for this? I have the same issue. Wordpress has a plug-in to take advantage of Google Index API. Don’t know if Webflow has a similar feature or how this can be accomplished.

In terms of trigger: im using Zapier to create the items on the cms. Perhaps this is a zapier issue?

You should be able to set up a webhook on Zapier that triggers a process on an application you build and host when a new item is added.

Is anyone interested in adding this functionality to my site as a small job?

Did anyone end up integrating this? looking to set it up on my next project for a news/media company. Would love to know how you went about it.