Showing
3 changed files
with
94 additions
and
0 deletions
nodejs/app.js
0 → 100644
1 | +const request = require('request'); | ||
2 | +const TARGET_URL = 'https://api.line.me/v2/bot/message/push' | ||
3 | +const MULTI_TARGET_URL = 'https://api.line.me/v2/bot/message/multicast' | ||
4 | +const BROAD_TARGET_URL = 'https://api.line.me/v2/bot/message/broadcast' | ||
5 | +const TOKEN = '' | ||
6 | +const USER_ID = 'U2d841876b98eeabbdc2102f467546d00' | ||
7 | + | ||
8 | +// Single User | ||
9 | +// request.post( | ||
10 | +// { | ||
11 | +// url: TARGET_URL, | ||
12 | +// headers: { | ||
13 | +// 'Authorization': `Bearer ${TOKEN}` | ||
14 | +// }, | ||
15 | +// json: { | ||
16 | +// "to": `${USER_ID}`, | ||
17 | +// "messages":[ | ||
18 | +// { | ||
19 | +// "type":"text", | ||
20 | +// "text":"Hello, user" | ||
21 | +// }, | ||
22 | +// { | ||
23 | +// "type":"text", | ||
24 | +// "text":"May I help you?" | ||
25 | +// } | ||
26 | +// ] | ||
27 | +// } | ||
28 | +// },(error, response, body) => { | ||
29 | +// console.log(body) | ||
30 | +// }); | ||
31 | + | ||
32 | + | ||
33 | +// Multicast User | ||
34 | +// request.post( | ||
35 | +// { | ||
36 | +// url: MULTI_TARGET_URL, | ||
37 | +// headers: { | ||
38 | +// 'Authorization': `Bearer ${TOKEN}` | ||
39 | +// }, | ||
40 | +// json: { | ||
41 | +// "to": [`${USER_ID}`], | ||
42 | +// "messages":[ | ||
43 | +// { | ||
44 | +// "type":"text", | ||
45 | +// "text":"Hello, user" | ||
46 | +// }, | ||
47 | +// { | ||
48 | +// "type":"text", | ||
49 | +// "text":"May I help you?" | ||
50 | +// } | ||
51 | +// ] | ||
52 | +// } | ||
53 | +// },(error, response, body) => { | ||
54 | +// console.log(body) | ||
55 | +// }); | ||
56 | + | ||
57 | + | ||
58 | +// Broadcast | ||
59 | + request.post( | ||
60 | + { | ||
61 | + url: BROAD_TARGET_URL, | ||
62 | + headers: { | ||
63 | + 'Authorization': `Bearer ${TOKEN}` | ||
64 | + }, | ||
65 | + json: { | ||
66 | + "messages":[ | ||
67 | + { | ||
68 | + "type":"text", | ||
69 | + "text":"Hello, user" | ||
70 | + }, | ||
71 | + { | ||
72 | + "type":"text", | ||
73 | + "text":"May I help you?" | ||
74 | + } | ||
75 | + ] | ||
76 | + } | ||
77 | + },(error, response, body) => { | ||
78 | + console.log(body) | ||
79 | + }); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
nodejs/package-lock.json
0 → 100644
This diff is collapsed. Click to expand it.
nodejs/package.json
0 → 100644
1 | +{ | ||
2 | + "name": "push", | ||
3 | + "version": "1.0.0", | ||
4 | + "description": "", | ||
5 | + "main": "app.js", | ||
6 | + "scripts": { | ||
7 | + "test": "echo \"Error: no test specified\" && exit 1" | ||
8 | + }, | ||
9 | + "author": "", | ||
10 | + "license": "ISC", | ||
11 | + "dependencies": { | ||
12 | + "python-shell": "^2.0.1", | ||
13 | + "request": "^2.88.2" | ||
14 | + } | ||
15 | + } | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment