From 557d75c7881bd5a59ca871b1ba3adc35c55c045e Mon Sep 17 00:00:00 2001 From: "Glitch (marshy-lyrical-asphalt)" Date: Fri, 4 Jun 2021 22:41:37 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=93=96=F0=9F=8C=B1=20Updated=20with?= =?UTF-8?q?=20Glitch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .glitch-assets | 3 +++ README.md | 27 +++++++++++++++++++++++++++ package.json | 26 ++++++++++++++++++++++++++ server.js | 20 ++++++++++++++++++++ test | 1 - 5 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 .glitch-assets create mode 100644 README.md create mode 100644 package.json create mode 100644 server.js delete mode 100644 test diff --git a/.glitch-assets b/.glitch-assets new file mode 100644 index 0000000..89fbc11 --- /dev/null +++ b/.glitch-assets @@ -0,0 +1,3 @@ +{"name":"drag-in-files.svg","date":"2016-10-22T16:17:49.954Z","url":"https://cdn.hyperdev.com/drag-in-files.svg","type":"image/svg","size":7646,"imageWidth":276,"imageHeight":276,"thumbnail":"https://cdn.hyperdev.com/drag-in-files.svg","thumbnailWidth":276,"thumbnailHeight":276,"dominantColor":"rgb(102, 153, 205)","uuid":"adSBq97hhhpFNUna"} +{"name":"click-me.svg","date":"2016-10-23T16:17:49.954Z","url":"https://cdn.hyperdev.com/click-me.svg","type":"image/svg","size":7116,"imageWidth":276,"imageHeight":276,"thumbnail":"https://cdn.hyperdev.com/click-me.svg","thumbnailWidth":276,"thumbnailHeight":276,"dominantColor":"rgb(243, 185, 186)","uuid":"adSBq97hhhpFNUnb"} +{"name":"paste-me.svg","date":"2016-10-24T16:17:49.954Z","url":"https://cdn.hyperdev.com/paste-me.svg","type":"image/svg","size":7242,"imageWidth":276,"imageHeight":276,"thumbnail":"https://cdn.hyperdev.com/paste-me.svg","thumbnailWidth":276,"thumbnailHeight":276,"dominantColor":"rgb(42, 179, 185)","uuid":"adSBq97hhhpFNUnc"} diff --git a/README.md b/README.md new file mode 100644 index 0000000..16fc712 --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +Welcome to the Glitch BETA +========================= + +Click `Show` in the header to see your app live. Updates to your code will instantly deploy and update live. + +Glitch is a developer playground that lets you code a real web-app without the slow setup and deployment steps. + +[About Glitch](https://glitch.com/about) + + +Your Project +------------ + +On the back-end, +- your app starts at `server.js` +- add frameworks and packages in `package.json` +- safely store app secrets in `.env` + +On the front-end, +- edit `public/client.js`, `public/style.css` and `views/index.html` +- drag in `assets`, like images or music, to add them to your project + + +Made by Fog Creek +----------------- + +\ 悜o悜)惎 diff --git a/package.json b/package.json new file mode 100644 index 0000000..35a0d2a --- /dev/null +++ b/package.json @@ -0,0 +1,26 @@ +{ + "name": "wa-webhooks-test", + "version": "0.0.1", + "description": "This is a boilerplate app used to test WhatsApp webhooks", + "main": "server.js", + "scripts": { + "start": "node server.js" + }, + "dependencies": { + "express": "^4.16.3", + "body-parser": "^1.18.3", + "crypto-js": "^3.3.0" + }, + "engines": { + "node": "6.10.x" + }, + "repository": { + "url": "https://glitch.com/edit/#!/welcome-project" + }, + "license": "MIT", + "keywords": [ + "node", + "glitch", + "express" + ] +} \ No newline at end of file diff --git a/server.js b/server.js new file mode 100644 index 0000000..18ea72c --- /dev/null +++ b/server.js @@ -0,0 +1,20 @@ +var express = require('express') + , bodyParser = require('body-parser'); + +var app = express(); + +app.use(bodyParser.urlencoded({extended: false})); +app.use(bodyParser.json()) + +app.get("/", function (request, response) { + response.send('Simple WhatsApp Webhook tester
There is no front-end, see server.js for implementation!'); +}); + +app.post("/webhook", function (request, response) { + console.log('Incoming webhook: ' + JSON.stringify(request.body)); + response.sendStatus(200); +}); + +var listener = app.listen(process.env.PORT, function () { + console.log('Your app is listening on port ' + listener.address().port); +}); \ No newline at end of file diff --git a/test b/test deleted file mode 100644 index 9daeafb..0000000 --- a/test +++ /dev/null @@ -1 +0,0 @@ -test From cc55fc8e2c2890798bbe41d127afaf51677f00eb Mon Sep 17 00:00:00 2001 From: "Glitch (marshy-lyrical-asphalt)" Date: Fri, 4 Jun 2021 22:45:02 +0000 Subject: [PATCH 2/2] Whatsapp