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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Who's Online   0 Members, 0 Anonymous, 106 Guests (See full list)

    • There are no registered users currently online
×
×
  • 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