Skip to content

PowerShell

Send Message via REST API

powershell
$body = @{
  dock_id = "<Dock ID>"
  secret_key = "<Secret Key>"
  msg = "Hello from PowerShell!"
} | ConvertTo-Json

Invoke-RestMethod -Uri "https://api.pingdock.io/ping" `
  -Method Post `
  -ContentType "application/json" `
  -Body $body

Send Message via Webhook

powershell
$body = @{ msg = "Webhook from PowerShell!" } | ConvertTo-Json

$pair = "<Dock ID>:<Secret Key>"  
$encodedAuth = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes($pair))

Invoke-RestMethod -Uri "https://api.pingdock.io/webhook" `
  -Method Post `
  -Headers @{ Authorization = "Basic $encodedAuth" } `
  -ContentType "application/json" `
  -Body $body