Google Search Console [GAME CHANGER]

Hi All,

I think this could be a big one for each of us. Many of us create blogposts/pages on their website with AI in big numbers. A new post or page is great but it hangs on being indexed by Google. With the Google Search Console API you can notify Google to crawl your newly created page/blogpost and start indexing this one.

This will be a great addition in creating content that is found!

Please VOTE if you also would like to have this feature.

KR Bram

This can be easily added as a New Code Step in our flows.
I might have a code for this lying somewhere, will find it, test it and share it.

Do Note: You need to generate/download key.json file form Google, Please do that in the meantime by following the instructions in the link you shared.

1 Like

Thanks Drhuv! I have it all set-up on Pabbly, would be great to move it over here.

1 Like

This would be cool and upvoted. I just added a ‘Need Help’ to add an automation to index with OMEGA Indexer when a post is published, which looks easy but I don’t know what I’m doing :slight_smile:

@Bram @Richard Got google indexing working, Please follow the steps and let me know if this works for you.

Add a new code block after creating your WordPress post/page - As long as we have a URL we want to index, this will work.

Focus on Step 10

Add a new code block and within that add a new variable in inputs named url which contains the actual URL we want to index.

Open/expand the code editor and click on “Add npm package” and enter googleapis in the package name field.

Your package.json file should look like this

{
  "dependencies": {
    "googleapis": "133.0.0"
  }
}

Now, Replace the entire code you have in your code block with this (index.ts file)

import { google } from 'googleapis'

// the key.json file you downloaded form Google
const key = {
  "type": "",
  "project_id": "",
  "private_key_id": "",
  "private_key": "",
  "client_email": "",
  "client_id": "",
  "auth_uri": "",
  "token_uri": "",
  "auth_provider_x509_cert_url": "",
  "client_x509_cert_url": "",
  "universe_domain": ""
}

export const code = async (inputs) => {
    try {
        // create the client
        const jwtClient = new google.auth.JWT(
            key.client_email,
            null,
            key.private_key,
            ["https://www.googleapis.com/auth/indexing"],
            null
        );

        const URL_TO_INDEX = inputs.url // This is the url we want to index

        const tokens = await jwtClient.authorize()

        // make the API call
        const response = await fetch("https://indexing.googleapis.com/v3/urlNotifications:publish", {
            method: "POST",
            headers: {
                "Content-Type": "application/json",
                "Authorization": `Bearer ${tokens.access_token}`
            },
            body: JSON.stringify({ url: URL_TO_INDEX, type: "URL_UPDATED" })
        })

        if( response.status !== 200 ) {
            console.log('error:response', response)
            return { success: false }
        }

        const responseJson = await response.json()
        return { success: true, data: responseJson }

    } catch (error) {
        console.log('catch error', error)
        return { success: false, error: error?.message || 'Error occurred' };
    }
};

Final step: focus on lines 4-16, This is the data you downloaded from Google key.json file. Replace this data with your own data.

Test and verify, Hope this works for you guys.

If you get any error, It should be visible in the console tab of code editor.

4 Likes