Readme

Export function to publish NTFY notification

reference: https://docs.ntfy.sh/publish/#publish-as-json

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
interface NtfyJSONBody {
/*
* Target topic name
*/
topic: string;
/*
* Message body; set to triggered if empty or not passed
*/
message?: string;
/*
* Message title
*/
title?: string;
/*
* List of tags that may or not map to emojis
*/
tags?: (NtfyEmojiTags)[] | string[];
/*
* Message priority with 1=min, 3=default and 5=max
*/
priority?: 1 | 2 | 3 | 4 | 5;
/*
* Custom user action buttons for notifications
*/
actions?: NtfyAction;
/*
* Website opened when notification is clicked
*/
click?: string;
/*
* URL of an attachment, see attach via URL
*/
attach?: string;
/*
* Set to true if the message is Markdown-formatted
*/
markdown?: boolean;
/*
* URL to use as notification icon
*/
icon?: string;
/*
* File name of the attachment
* @example: file.jpg
*/
filename?: string;
/*
* Timestamp or duration for delayed delivery
* @example 30min, 9am
*/
delay?: string;
/*
* E-mail address for e-mail notifications
* @example phil@example.com
*/
email?: string;
/*
* Phone number to use for voice call
* @example +1222334444 or yes
*/
call?: string;
}
type NtfyEmojiTags =
| "+1"
| "partying_face"
| "tada"
| "heavy_check_mark"
| "loudspeaker"
| "-1"
| "warning"
| "rotating_light"
| "triangular_flag_on_post"
| "skull"
| "facepalm"
| "no_entry"
| "no_entry_sign"
| "cd"
| "computer";
type NtfyAction = NtfyHTTPAction | NtfyViewAction | NtfyBroadcastAction;
interface NtfyHTTPAction {
action: "http";
/*
* Label of the action button in the notification
* @example Open garage door
*/
label: string;
/*
* URL to which the HTTP request will be sent
*/
url: string;
/*
* HTTP method to use for request, default is POST
*/
method?: string;
/*
* HTTP headers to pass in request. When publishing as JSON, headers are passed as a map.
* When the simple format is used, use headers.<header1>=<value>.
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
March 20, 2024