EC2 Default User

Configure webhook

Showing 1 changed file with 19 additions and 5 deletions
......@@ -2,16 +2,30 @@ const express = require('express');
const fs = require('fs');
const path = require('path');
const HTTPS = require('https');
const app = express();
const domain = "2020105659.osschatbot.cf"
const sslport = 23023;
app.get('/', function (req, res) {
res.send('Hello World');
})
//Configure webhook
const bodyParser = require('body-parser');
const app = express();
app.use(bodyParser.json());
app.post('/hook', function (request, response) {
var eventObj = request.body.events[0];
var source = eventObj.source;
var message = eventObj.message;
// request log
console.log('======================', new Date() ,'======================');
console.log('[request]', request.body);
console.log('[request source] ', eventObj.source);
console.log('[request message]', eventObj.message);
response.sendStatus(200);
});
//Set SSL
try {
const option = {
ca: fs.readFileSync('/etc/letsencrypt/live/' + domain +'/fullchain.pem'),
......