PowerShell

Do you need to trigger a notification using PowerShell  ?

Notification template

If you want to pass variables to a notification template, first copy the template URL and then use the following script:

notify17-template.ps1
$templateUrl = "REPLACE_WITH_TEMPLATE_URL"

# This is the template's payload, which gets converted to JSON
$body = @{
  "name"="Hello"
  "email"="example@gmail.com"
} | ConvertTo-Json

# This header tells we're passing a JSON payload
$header = @{
  "Content-Type"="application/json"
} 

# Notify17 invocation
Invoke-RestMethod -Uri $templateUrl -Method 'Post' -Body $body -Headers $header

Note: you can test the previous script by importing the following template:

Template Payload (YAML)
Example - Dump

---

{{/* dump all the request variables */}}
{{ dump . }}
name: Mr. Anderson
Rendered
Example - Dump

---

name: Mr. Anderson

Raw API key

If you want to use a raw API key, create and copy it, and use the following script:

notify17-raw-api-key.ps1
$apiKeyUrl = "REPLACE_WITH_RAW_API_KEY_URL"

# This is the notification data, which gets converted to JSON
$body = @{
  "title"="This is a title"
  "content"=@'
This is a 
multiline string!
'@
} | ConvertTo-Json

# This header tells we're passing a JSON payload
$header = @{
  "Content-Type"="application/json"
} 

# Notify17 invocation
Invoke-RestMethod -Uri $apiKeyUrl -Method 'Post' -Body $body -Headers $header