Introduction
This guide will walk you through integrating Ntfy with TeraCopy to receive real-time notifications after each file transfer job is completed. By setting up Ntfy notifications, you can stay informed about your file transfers without constantly monitoring TeraCopy.
Prerequisites
TeraCopy is installed on your Windows computer.
An active internet connection to access Ntfy services.
Steps
1. Open the Ntfy Web Application
Navigate to https://ntfy.sh/app using your preferred web browser.
2. Generate and Copy a Topic Name
Click on "Subscribe to topic".
Select "Generate name" to create a unique topic.
Copy the generated topic name for later use.
3. Access the TeraCopy Scripts Folder
Press Win + R on your keyboard to open the Run dialog.
Type %APPDATA%\TeraCopy\Scripts into the dialog box.
Press Enter to open the Scripts folder.
4. Edit the Script
Locate the Notify via Ntfy.ps1 script in the Scripts folder.
Right-click the file and choose "Edit" or open it with a text editor like Notepad.
Find the placeholder YOUR_TOPIC within the script.
Replace YOUR_TOPIC with the topic name you copied earlier.
Save the changes and close the editor.
5. Configure TeraCopy to Use the Script
Open TeraCopy.
Navigate to the Options tab.
In the Scripts section, select Notify via Ntfy.ps1 from the dropdown menu.
6. Set the Script as Default
Click on the "Save as default" button.
This action ensures the script will execute automatically after each job completion.
7. Test the Setup
Perform a test file transfer using TeraCopy.
Verify that you receive a notification via Ntfy upon completion.
Notify via Ntfy.ps1 source code
Notify via Ntfy.ps1 source code
param ($source, $target, [int64] $size, $time, [int64] $failed, [int64] $skipped)
write-host "Transfer completed:"
write-host " Source: $source"
write-host " Target: $target"
write-host " Failed: $failed, skipped: $skipped"
$fsize = "{0:N0}" -f $size
write-host " Size: $fsize"
write-host " Time: $time"
write-host ""
write-host "Sending notification..."
$topic = 'YOUR_TOPIC'
if ($topic -eq 'YOUR_TOPIC') {
write-host "Please subscribe to a topic in the Ntfy mobile app or at https://ntfy.sh/app and modify this script."
write-host "Press any key to locate this file..."
[void][System.Console]::ReadKey($true)
Invoke-Expression "explorer /select,$PSCommandPath"
exit
}
$url = "https://ntfy.sh/$topic"
$headers = @{
"Title" = "Transfer completed"
"Priority" = "default"
"Tags" = "heavy_check_mark"
}
$body = @"
Source: $source
Target: $target
$size bytes, $time
Failed: $failed, skipped: $skipped
"@
$response = Invoke-WebRequest -Method Post -Uri $url -Headers $headers -Body $body
write-host $response
Start-Sleep -Seconds 5