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 const client = new kafka.KafkaClient({ "kafkaHost": "localhost:9092" }); const consumer = new kafka.Consumer(client, [ { topic: ‘SENTIMENT-ALERT’ } ], { autoCommit: true, groupId: 'line-notify-group' }); consumer.on('message', function (message) { var sentiment_stats = JSON.parse(message.value); request({ method: 'POST', uri: 'https://notify-api.line.me/api/notify', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, auth: { 'bearer': token }, form: { message: sentiment_stats.sentiment } }, (err, httpResponse, body) => { if (err) { Message Sentiment Monitoring Sample Use Case
NOTIFY SERVICE line-notify.js (Sample Code) Send Notify to admin