diff --git a/package-lock.json b/package-lock.json index 8c5e1f5..35606e8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -70,6 +70,14 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==" }, + "axios": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz", + "integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==", + "requires": { + "follow-redirects": "^1.10.0" + } + }, "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -340,6 +348,11 @@ "unpipe": "~1.0.0" } }, + "follow-redirects": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.1.tgz", + "integrity": "sha512-HWqDgT7ZEkqRzBvc2s64vSZ/hfOceEol3ac/7tKwzuvEyWx3/4UegXh5oBOIotkGsObyk3xznnSRVADBgWSQVg==" + }, "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", diff --git a/package.json b/package.json index 29d2162..b008a30 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "author": "", "license": "ISC", "dependencies": { + "axios": "^0.21.1", "body-parser": "^1.19.0", "dotenv": "^10.0.0", "ejs": "^3.1.6", diff --git a/routes/webhook.route.js b/routes/webhook.route.js index bbc3168..bc27752 100644 --- a/routes/webhook.route.js +++ b/routes/webhook.route.js @@ -105,7 +105,7 @@ router.post('/', (req, res) => { // Handles messages events -function handleMessage(senderPsid, receivedMessage) { +async function handleMessage(senderPsid, receivedMessage) { let response; // Checks if the message contains text if (receivedMessage.text) {