Script to delete user from StatusPage and notify slack.
This script utilizes the StatusPage API to get a list of users, then it will make use of the email address supplied to match it to a record, then submit a delete request for said record. Optionally The script will then notify a slack channel of the outcome, whether successful or failed, making use of a slack webhook.
With no switches the parameters will be taken in the following order: StatusPage org ID, StatusPage API token, email to be deleted, and optionally the slack webhook URL to send a notification of the outcome, whether it failed or succeeded.
statuspage_userdel.ps1 <StatusPage_organization_ID> <StatusPage_Token> <[email protected]> (Optional)<Slack_WebHook>
statuspage_userdel.ps1 "xabcd123"
"asdcefghijklmnop-1234567890"
"[email protected]"
"https://hooks.slack.com/services/abcdef/abcdefgh/abcdefghijk"
With specified switches the parameters can go in any order, in this example the order stays the same but it is not required.
statuspage_userdel.ps1 -orgID
"xabcd123"
-token"asdcefghijklmnop-1234567890"
-email"[email protected]"
-slackURL"https://hooks.slack.com/services/abcdef/abcdefgh/abcdefghijk"