Hello @HippoMan,
certbot will pass to your script the variables CERTBOT_DOMAIN containing the domain being authenticated and CERTBOT_VALIDATION containing validation string that you must use on the txt record to validate your domain.
CERTBOT_DOMAIN
CERTBOT_VALIDATION
Here is the doc with several examples User Guide — Certbot 2.7.0.dev0 documentation
Cheers, sahsanu