Code: Select all
function OnCanRunProfile(const ProfileName: UnicodeString; var PostponeBySeconds: Integer): Boolean;
var
ntfy_username, ntfy_password, PostData, AdditionalHeaders, URL, Response, ErrorResponse: AnsiString;
ResultCode: Int64;
begin
ntfy_username := 'username';
ntfy_password := 'password';
PostData := 'Backup of the Master Output share is starting';
AdditionalHeaders := 'Title: Syncovery Backup Starting...'+#10#13+
'Priority: default'+#10#13+
'Tags: arrows_counterclockwise'+#10#13+
'Authorization: Basic ' + EncodeBase64(ntfy_username + ':' + ntfy_password)+#10#13+
'Content-Type: application/x-www-form-urlencoded';
URL := 'https://ntfy.url.com/Beltzer';
ResultCode := 0;
Response := '';
ErrorResponse := '';
if SendHTTPRequest('POST', '', AdditionalHeaders, URL, PostData, ResultCode, Response, ErrorResponse) then
begin
// HTTP request was successful, do something with the response
end
else
begin
// HTTP request failed, do something with the error response
end;
Result := True; // or False, depending on your requirements
end;
Please let me know if there is any obvious issues with this code