-
Notifications
You must be signed in to change notification settings - Fork 1
/
reminder.js
38 lines (32 loc) · 830 Bytes
/
reminder.js
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
'use strict';
const line = require('@line/bot-sdk');
const defaultAccessToken = 'CHANNEL_ACCESS_TOKEN';
const defaultSecret = 'CHANNEL_SECRET';
const defaultUserId = 'USER_ID';
// create LINE SDK config from env variables
const config = {
channelAccessToken: process.env.CHANNEL_ACCESS_TOKEN || defaultAccessToken,
channelSecret: process.env.CHANNEL_SECRET || defaultSecret,
};
// create LINE SDK client
const client = new line.Client(config);
// create user ID from env variable
const userId = process.env.USER_ID || defaultUserId;
let message = [
{
type: "text",
text: "Hello world!"
},
{
type: "sticker",
packageId: "1",
stickerId: "410"
}
];
client
.pushMessage(userId, message)
.then(() => console.log({
success: true,
events: message
}))
.catch(err => console.log(err))