Jump to content

Custom Action to fire Discord Webhook


XYBERVIRI

Recommended Posts

I figured out the following to let users send custom messages via scheduled task to their discord for any game with out the use of a bot, using powershell custom actions

I used the following custom variables:

discord_username, discord_avatarurl, discord_message, discord_webhook

 

$payload = [PSCustomObject]@{
    username = $ThisService.Variables.Values["discord_username"]
    avatar_url = $ThisService.Variables.Values["discord_avatarurl"]
    content = $ThisService.Variables.Values["discord_message"]      
}

Invoke-RestMethod -Uri $ThisService.Variables.Values["discord_webhook"] -Method Post -Body ($payload | ConvertTo-Json -Depth 100) -ContentType 'application/json'

Make sure your variables are set as script parameters: https://help.tcadmin.com/Custom_Scripts#Capture_values_before_executing_the_script

 

 

Edited by XYBERVIRI
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use