Twitter Bot - VMware Product Lifecycle Matrix

Last year I wanted to learn Python, and I didn’t really know what serverless (ie: AWS Lambda) was, so I looked for a project where I could learn.

TL;DR Serverless is just somewhere to run your code from 🤣

Something that I find hard to keep track of, is when VMware products are coming up to their end of supports dates. Sometimes the dates change. I’m not going to check for updates each week, but I am on Twitter a lot. *Bam* I should make a Twitter bot that tweets when VMware products are approaching end of support dates.

Here’s how I did it.

Disclaimer: I’m still learning python, so if you have better ways to do things, let me know.

Twitter API

Sign up for a Twitter developer account. Then follow the docs to obtain you own Twitter API keys.

Discovering headers

Looking at, it does some back and forth before showing the product lifecycle matrix. The nice thing is that it send it to our browser in JSON.

Firing up Burp Suite to view headers, I turned on intercept, and opened the browser built into Burp Suite. (Burp Suite comes with Kali)


Then browse to

You can forward all the requests, and eventually see a POST to Wow, look at all those other non-related requests!


Look at the body of the request.


These details were sent to us in a response from our GET, but the values are always the same, so for now we’ll hardcode those values. The response shows a possible typo clientSeret: "84e0f320-5c9d-4ced-a99b-3cc0a7ad64a9" (clientSecret?).

You can see the response in the screenshot showing access_token is what we’ll need for our next request.


Now we can do GET and set X-Auth-Key


And the response is a 560k JSON file. Booya!

You can test this using Postman, or start some Python coding to do it.

Python - GET JSON - Check dates - Tweet

Last year I used the Python module Twython, but it felt a bit heavy for my needs, and I wanted something simple. I found TwitterAPI, and it was exactly what I was after.

Using the above information, I ended up with:

Updated code at

import requests
import json
from datetime import datetime, timedelta, date
from TwitterAPI import TwitterAPI

def GetProductLifecycleMatrixJSON():
    url = ''
    custom_header = {
        "Content-Type": "application/json"

    json_body = {

    r =,headers = custom_header, json = json_body)
    data = (r.text).split("\"")

    url = ''

    custom_header = {

    r2 = requests.get(url,headers = custom_header)

    return r2.text

def sendOutput(product, reason, days):
    tag = "#ProductLifecycleMatrix"
    tagUrl = ""
    if days == 0:
        tweet_text = f'{product} reaches {reason} TODAY. {tagUrl} {tag}'
        tweet_text = f'{product} reaches {reason} in {days} days. {tagUrl} {tag}'


    api = TwitterAPI(consumer_key, 

    # Comment out below to prevent from tweeting while testing
    r = api.request('statuses/update', {'status': tweet_text})
    print('SUCCESS' if r.status_code == 200 else 'PROBLEM: ' + r.text)

def significantDate(plmrecord):

    today =

    # How many days in advanced to check.
    daysWarning = [0, 30, 90, 180, 365]     # Set this on when to trigger alerts. Days before event.
    futureDate = [0] * len(daysWarning)     # Prepare array to store futureDates

    # Set future days to check. 
    for i in range(len(daysWarning)):
        futureDate[i] = today + timedelta(days = daysWarning[i])

    for i in range(len(futureDate)):
        # Check End of support dates
        if datetime.strptime(plmrecord["end_support_date"], "%Y-%m-%d").date() == futureDate[i]:
            sendOutput(plmrecord["name"],"end of general support", daysWarning[i])
        # Check End of technical guidance
        if plmrecord["end_tech_guidance_date"] != None: # Some records have null
            if datetime.strptime(plmrecord["end_tech_guidance_date"], "%Y-%m-%d").date() == futureDate[i]:
                sendOutput(plmrecord["name"],"end of technical guidance", daysWarning[i])
plmdata  = json.loads(GetProductLifecycleMatrixJSON())

for i in range(len(plmdata["supported"])):

print("Processed ", i, "records")

Testing this locally it seemed to work. I could schedule this to run from my workstation, but here’s where serverless comes in.

AWS Lamba

To run the code in AWS Lambda I had to make a few minor changes.

I renamed my code, and moved the main code inside a function called def main(event, context):

Package up your python code & TwitterAPI following Deploy Python Lambda functions with .zip file archives.

Open up the AWS Lamba console, and choose “Create function”

Set a function name, and choose Python 3.9 for Runtime.

Create AWS Lambda function

Back at the Code menu within the Lambda AWS console, upload the zip file you just created.

If you click Test, it will run the code. Be careful if you are tweeting from the code. Twitter won’t let you tweet the same thing twice within a certain timeframe.

Click Deploy to publish those changes.

Click + Add trigger, and choose EventBridge (CloudWatch Events).

Set the name, and schedule expression. Check out Cron cheatsheet for help.

Add trigger

If you’ve run it manually using the Test option, or the scheduled time has past, you can click Monitor / Logs / View logs in CLoudWatch and see output of any print() statements.

Now I need to think of other projects to fill the void.

Andrew Dauncey
Andrew Dauncey
Senior Consultant at VMware PSO

Every day I’m shuffling