How to build 3 automated SEO audits with Python and Slack

September 27, 2021 - 3  min reading time - by Stefan Neefischer
Accueil > Technical SEO > Build 3 automated SEO audits with Python and Slack


Especially during the post-pandemic period, digital marketing has become the main focus for many industries and Python has obviously become the latest trend in marketing automation, in which we’ve contributed a lot.
With Python scripts, we have first shown you how to analyze close variant matches, then we scraped the Google Autosuggest with the help of our Python magicians.
Now that everyone is aware of the benefits of SEO & Python in the long run, it’s time to focus on the cost efficiency. That is, the common tools for SEO are sometimes costly, but as marketeers, we cannot afford avoiding scheduled SEO audits to evaluate our content and optimization. With this article, you’ll be able to build automated SEO audits with three example Python audit scripts. Here’s how we do it.

  • Modify the Settings of your Slack to be able to send notifications and upload files.
  • Audit Job #1:“Sitemap Status Code Checker”
    Report the number of cases with status codes different than 20x
    Attach URL + Bad Status Code as File to the message
  • Audit Job #2: “Internal Link Checker”
    Check all internal links found on the website — report the number of cases with bad status code
    Attach file for bad cases with URL where the link was found, the link url, the link status code and the link anchor text
  • Audit Job #3: “Missing Meta Description Checker”
    Check for missing meta description on all URLs — report the number of cases
    Attach URLs with missing meta description as file

The key point here is that this system works for a lot of similar stuff. Just stay creative. You can even monitor your competitor’s websites with Slack + Python automation.

Set up your monitoring App on Slack

First, we need an operating Slack environment, which offers a free plan as well.

  1. When you have Slack Workspace, go to this link and create a new app
  2. Click “Create new app”
  3. Type in your app name, e.g. SEO Audit, and choose your Slack workspace
  4. Now, you need to add some features for sending notifications and files to Slack out of your Python script. Go to “OAuth & Permissions”
  5. Under “Bot Token Scopes”, add the following OAuth Scopes:
    files:write
    channels:join
    chat:write
  6. Click “install to the workspace” and you will have an OAuth Access Token: Copy and paste in your Python script.
  7. This part is almost done  — now just select a channel where you want to send messages to. Use the “Add Apps” menu item and search for your SEO monitoring app.

[Case Study] Handling multiple site audits

In a few weeks, using OnCrawl has helped Evergreen Media with SEO quick wins regarding Google Featured Snippets, snippet optimization, rankings improvements for converting pages, 404 errors... Find out how OnCrawl can ease any SEO agency’s workflow when it comes to SEO audits.

3 Basic SEO Audits with Python

Feel free to add as many check routines as you wish, this is only a blueprint. Simply modify the sitemap URL, add your OAuth Access, then you’re free to go.
Here is the code link-

Build Automated SEO Audits with Slack+Python

Time to run and schedule your scripts

  • We recommend using a cloud environment. Cloud Functions or Cloud Runs, triggered with Pub/Sub, can be used.
  • Another practical method is to make use of a small virtual server, which are widely provided. They tend to run on Linux. Feel free to add your Python code there and schedule it by using the good old crontab.
  • Want to have some fun? You could also use a RaspberryPi and run your own Linux based 24×7 in-house server, which is quite affordable (around $60) and portable, so you can place and hide it easily somewhere. A perfect project for Covid lockdowns!


Image by the author: A bit fun, automated your SEO with home server

We hope you enjoyed this article. By automating your SEO audits with creative and practical Python scripts, you won’t have to reserve a budget for costly tools out there.
Now, it’s time to take one step further, feel free to try our scripts, where the magic of performance marketing happens.

Stefan is a highly data driven person with a passion for PPC. He started 20 years ago with data crunching in Perl - now Python is his weapon of choice. It is fun for him to work on complex problems and deliver creative solutions.
Related subjects: