This Python script generates a Chuck Norris joke and personalizes it with a random name from a list. The joke is then sent to a Microsoft Teams channel via a webhook.
- Python 3
- requests
- json
- random
- re
- pymsteams
To install the dependencies, run the following command:
pip install requests json random re pymsteams
- Replace Insert_Here_Your_MS_Teams_Webhook_URL in line 28 with the URL of your Microsoft Teams webhook.
- To create a MS Teams webhook, please check my article at https://medium.com/@jacopocastellano/chuck-norris-comes-to-ms-teams-a-joke-generator-script-a98e03146818 or the official documentation at https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook?tabs=dotnet.
- Run the script with
python Chuck_Norris_Jokes.py
.
You can add or remove names from the list_of_names list on line 15 to personalize the script. The frequency of the script can be changed by scheduling it in crontab.
I am not responsible for the inappropriate use of the jokes generated by this script. Please use it at your own discretion and make sure to follow the guidelines and policies of your organization or platform.
- Chuck Norris API by Mathias Chilling (https://www.matchilling.com/): https://api.chucknorris.io/