UNPKG

2.06 kBJavaScriptView Raw
1module.exports = {
2
3 name: "<%=name%>",
4
5 label: "<%=title%>",
6
7 version: "<%=version%>",
8
9 input: {
10 type: "object",
11 title: "<%=title%>",
12 description: "Short description",
13 properties: {
14 event: {
15 type: "string",
16 enum: ["<%=name%>"]
17 },
18 polling: {
19 type: "boolean",
20 default: false,
21 options: {
22 hidden: true
23 }
24 }
25 }
26 },
27
28 output: {
29 "<%=name%>": {
30 type: "object",
31 properties: {
32
33 }
34 }
35 },
36
37 mock_data: {}, // output of trigger data
38
39 mock_input: {},
40
41 execute: function (input, payload, output) {
42 // will be invoked when the event is triggered
43 // to access auth info use input.auth , eg: input.auth.username
44 // and to return output use output callback like this output(null, [{ mykey : 'key', value : 'My Val'}])
45 // output should be an array of objects or an empty array.
46
47 // your code goes here
48
49 output(null, []);
50
51 },
52
53 register: function (input, output) {
54 // function will be used for registering webhook with services additional key
55 // 'webhook' along with input data will be available here so you can access the input.webhook
56 // for registering the webhook
57 output("failed");
58 },
59
60 unregister: function (input, options, output) {
61 // will be invoked when user deletes the trigger for unregistering the webhook
62 // webhook id will be available in input.webhookId
63
64 // your code goes here
65 output(null, true);
66 },
67
68 activate: function (input, options, output) {
69 // this function will be called whenever user activate or reactivates flow
70 // to access auth info use input.auth , eg: input.auth.username
71 // you can use this function to reset your cursor or timestamp
72
73 // your code goes here
74
75 output(null, true);
76 },
77
78 update: function (input, output) {
79 // Use this function for service which don't allow to register more than two webhook
80 // for same resource
81 // NOTE: Do not edit this function if not necessary
82 return output(null, [ ]);
83 }
84}