diff --git a/node/send_sms_with_vonage/package-lock.json b/node/send_sms_with_vonage/package-lock.json new file mode 100644 index 00000000..75da2d33 --- /dev/null +++ b/node/send_sms_with_vonage/package-lock.json @@ -0,0 +1,380 @@ +{ + "name": "send_sms_with_vonage", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "send_sms_with_vonage", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "@vonage/auth": "^1.1.2", + "@vonage/server-sdk": "^3.2.0" + } + }, + "node_modules/@vonage/accounts": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@vonage/accounts/-/accounts-1.2.0.tgz", + "integrity": "sha512-cd5YzEi9w5K3pVjLgmWdpdlIJpm30SPlk8MM1+TeE6U99HVGkUESdg9LQF/wWe+HXXp9mNcd8U7sxBzfXB9upg==", + "dependencies": { + "@vonage/server-client": "^1.2.0" + } + }, + "node_modules/@vonage/applications": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@vonage/applications/-/applications-1.2.0.tgz", + "integrity": "sha512-ybEfiUm5khBI/wsp4Zn+rQjoiG9zrTGAMTKxlbXjXg+mi+oJPBitTuIU63eRC/h2/H7gGLQkAi/GK9UI/YGvrQ==", + "dependencies": { + "@vonage/auth": "^1.1.2", + "@vonage/server-client": "^1.2.0", + "@vonage/vetch": "^1.1.2" + } + }, + "node_modules/@vonage/auth": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@vonage/auth/-/auth-1.1.2.tgz", + "integrity": "sha512-DUXEAtIlhTPiF54nn+FptEQKDKy78CcYdL936uQUrNCZSFm0tJaHgEM2HSbRdbgbxzyYI7fcEmpZbTbxCxt4ZA==", + "dependencies": { + "@vonage/jwt": "^1.1.2", + "debug": "^4.3.4" + } + }, + "node_modules/@vonage/jwt": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@vonage/jwt/-/jwt-1.1.2.tgz", + "integrity": "sha512-H8I+lZzDItDfUB0gySGBtne+zQ2XtyBOfGR+C/qFQojEVQE8kXeJu5EPcyFBkqyrO9b64JdMdJMZAaMMmbyK0A==", + "dependencies": { + "debug": "^4.3.4", + "jsonwebtoken": "^9.0.0", + "uuid": "^9.0.0" + } + }, + "node_modules/@vonage/messages": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@vonage/messages/-/messages-1.2.0.tgz", + "integrity": "sha512-FDloGrRD8b5j/fGjOOGxKkZ2LcdfOVlmcfiLrRYgSlRpglwwmmXqs5+49w1sr9hrnqoN+NFNS2rK048OrKUZJA==", + "dependencies": { + "@vonage/auth": "^1.1.2", + "@vonage/server-client": "^1.2.0", + "@vonage/vetch": "^1.1.2" + } + }, + "node_modules/@vonage/number-insights": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@vonage/number-insights/-/number-insights-1.2.0.tgz", + "integrity": "sha512-V7J9rBYIGhKYKq/G3NGQi3rXjXXKiK8+0VMN0pncWZyvzsfdFScYmyDxb6gUSaHogcLZWIuO6SdeT0hm3fctlQ==", + "dependencies": { + "@vonage/auth": "^1.1.2", + "@vonage/server-client": "^1.2.0", + "@vonage/vetch": "^1.1.2" + } + }, + "node_modules/@vonage/numbers": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@vonage/numbers/-/numbers-1.2.0.tgz", + "integrity": "sha512-oeBJXq0C1++UzhgHFBjQYfqZx0p+mEmFcq2rWqXgz5cH13HZ54cAsnKEaU3I9CvhbhblFVt3l7woW9hF8fJc2A==", + "dependencies": { + "@vonage/auth": "^1.1.2", + "@vonage/server-client": "^1.2.0", + "@vonage/vetch": "^1.1.2", + "lodash.omit": "^4.5.0" + } + }, + "node_modules/@vonage/pricing": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@vonage/pricing/-/pricing-1.2.0.tgz", + "integrity": "sha512-7jbYB03svMIhrLSLvggRI4BCi9prAetwGKN6jK9qHSjhqcB0Uyo3mpj8YXBaVKfChMtEpMfUwdWhtR0W5OsW+Q==", + "dependencies": { + "@vonage/auth": "^1.1.2", + "@vonage/server-client": "^1.2.0", + "@vonage/vetch": "^1.1.2" + } + }, + "node_modules/@vonage/redact": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@vonage/redact/-/redact-1.1.0.tgz", + "integrity": "sha512-aJoLwS39wfMwPkWX1e/LBlz1jNxdQFtPgRSqvL8S3e0XHy8Jfv99Rrof9nmvEm1xoRY9deLS1tRdoJQJhJHqKA==", + "dependencies": { + "@vonage/server-client": "^1.2.0" + } + }, + "node_modules/@vonage/server-client": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@vonage/server-client/-/server-client-1.2.0.tgz", + "integrity": "sha512-tjsl1HOJQ2GuOwLM17+7Ul1cxqa+x4aAf9hLmQC5s2IW/OnoSApYe2QLJ0BCGxyARIiTFz2k8N6flW0DzixVUw==", + "dependencies": { + "@vonage/auth": "^1.1.2", + "@vonage/vetch": "^1.1.2", + "debug": "^4.3.4", + "lodash.camelcase": "^4.3.0", + "lodash.isobject": "3.0.2", + "lodash.kebabcase": "^4.1.1", + "lodash.partial": "^4.2.1", + "lodash.snakecase": "^4.1.1" + } + }, + "node_modules/@vonage/server-sdk": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@vonage/server-sdk/-/server-sdk-3.2.0.tgz", + "integrity": "sha512-YRySGU9FvHkXSt9vWYOCPy8MPlNgu5b0l9+tqMQIgjlCa9FBP+nLm9a5ZWeawefT83/l0iHBzvgO3l9wjverNw==", + "dependencies": { + "@vonage/accounts": "^1.2.0", + "@vonage/applications": "^1.2.0", + "@vonage/auth": "^1.0.10", + "@vonage/messages": "^1.2.0", + "@vonage/number-insights": "^1.2.0", + "@vonage/numbers": "^1.2.0", + "@vonage/pricing": "^1.2.0", + "@vonage/redact": "^1.1.0", + "@vonage/sms": "^1.2.0", + "@vonage/verify": "^1.2.0", + "@vonage/vetch": "^1.0.11", + "@vonage/voice": "^1.2.0" + } + }, + "node_modules/@vonage/sms": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@vonage/sms/-/sms-1.2.0.tgz", + "integrity": "sha512-FqU3cGsh7M/Tow8m+j9yA3/CWDWokCMSqMb04Xc+uFkVxSbdQdSpGh3cqeH8dtFIZOWiWILCk6d6EDAIYGXvbA==", + "dependencies": { + "@vonage/server-client": "^1.2.0", + "debug": "^4.3.4" + } + }, + "node_modules/@vonage/verify": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@vonage/verify/-/verify-1.2.0.tgz", + "integrity": "sha512-b4U8yKUyjqsdy9FZ7Uj0hG3ou8VH/SLUK2IklJ+YfzIrO/oaTHd6tLUeUxnw6y+2wEejrBLMSXzc/DV6bpV4CA==", + "dependencies": { + "@vonage/auth": "^1.1.2", + "@vonage/server-client": "^1.2.0", + "@vonage/vetch": "^1.1.2", + "lodash.omit": "^4.5.0" + } + }, + "node_modules/@vonage/vetch": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@vonage/vetch/-/vetch-1.1.2.tgz", + "integrity": "sha512-Fl/ezKhP5ceB+HkAbTtp/lIVsbxh4wGFJ7Y153mtgC6U+IVWz6s4VL8ENTRWiK2to7AJ6ahYqXvjVVElR+bbBg==", + "dependencies": { + "debug": "^4.3.4", + "lodash.merge": "^4.6.2", + "node-fetch": "^2.6" + } + }, + "node_modules/@vonage/voice": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@vonage/voice/-/voice-1.2.0.tgz", + "integrity": "sha512-d/rBKy4TJga2knKLPDQcZXuKXHgnrrXJtIASD+vpURZpfMNWUgP3ddwYshVUPAB+xP735KKtCGXyUrAKjLQ3qg==", + "dependencies": { + "@vonage/auth": "^1.1.2", + "@vonage/server-client": "^1.2.0", + "@vonage/vetch": "^1.1.2" + } + }, + "node_modules/buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==" + }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/jsonwebtoken": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.0.tgz", + "integrity": "sha512-tuGfYXxkQGDPnLJ7SibiQgVgeDgfbPq2k2ICcbgqW8WxWLBAxKQM/ZCu/IT8SOSwmaYl4dpTFCW5xZv7YbbWUw==", + "dependencies": { + "jws": "^3.2.2", + "lodash": "^4.17.21", + "ms": "^2.1.1", + "semver": "^7.3.8" + }, + "engines": { + "node": ">=12", + "npm": ">=6" + } + }, + "node_modules/jwa": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", + "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", + "dependencies": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/jws": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", + "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "dependencies": { + "jwa": "^1.4.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "node_modules/lodash.camelcase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", + "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==" + }, + "node_modules/lodash.isobject": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/lodash.isobject/-/lodash.isobject-3.0.2.tgz", + "integrity": "sha512-3/Qptq2vr7WeJbB4KHUSKlq8Pl7ASXi3UG6CMbBm8WRtXi8+GHm7mKaU3urfpSEzWe2wCIChs6/sdocUsTKJiA==" + }, + "node_modules/lodash.kebabcase": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz", + "integrity": "sha512-N8XRTIMMqqDgSy4VLKPnJ/+hpGZN+PHQiJnSenYqPaVV/NCqEogTnAdZLQiGKhxX+JCs8waWq2t1XHWKOmlY8g==" + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" + }, + "node_modules/lodash.omit": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.omit/-/lodash.omit-4.5.0.tgz", + "integrity": "sha512-XeqSp49hNGmlkj2EJlfrQFIzQ6lXdNro9sddtQzcJY8QaoC2GO0DT7xaIokHeyM+mIT0mPMlPvkYzg2xCuHdZg==" + }, + "node_modules/lodash.partial": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/lodash.partial/-/lodash.partial-4.2.1.tgz", + "integrity": "sha512-qsiGr0kiA31O7chhmKSUiEGtxXnYtwmaJF00TPAUW79C5PCfaVeLTUN3sLT+rEPcqZooPtiFcGhnphQzFhkqmg==" + }, + "node_modules/lodash.snakecase": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz", + "integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==" + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/node-fetch": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz", + "integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/semver": { + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "node_modules/uuid": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", + "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + } + } +} diff --git a/node/send_sms_with_vonage/package.json b/node/send_sms_with_vonage/package.json new file mode 100644 index 00000000..b5d8d944 --- /dev/null +++ b/node/send_sms_with_vonage/package.json @@ -0,0 +1,15 @@ +{ + "name": "send_sms_with_vonage", + "version": "1.0.0", + "description": "node function for sending message through vonage third party library", + "main": "src/index.js", + "scripts": { + "test": "node src/index.js" + }, + "author": "shivam singh", + "license": "ISC", + "dependencies": { + "@vonage/auth": "^1.1.2", + "@vonage/server-sdk": "^3.2.0" + } +} diff --git a/node/send_sms_with_vonage/phone_ss.jpg b/node/send_sms_with_vonage/phone_ss.jpg new file mode 100644 index 00000000..e1e2411d Binary files /dev/null and b/node/send_sms_with_vonage/phone_ss.jpg differ diff --git a/node/send_sms_with_vonage/src/index.js b/node/send_sms_with_vonage/src/index.js new file mode 100644 index 00000000..f2f4e13d --- /dev/null +++ b/node/send_sms_with_vonage/src/index.js @@ -0,0 +1,32 @@ +const { Vonage } = require('@vonage/server-sdk') +const {Auth} = require('@vonage/auth') + + +module.exports = async function test(req, res) { + + const credentials = new Auth({ + apiKey: req.variables["API_KEY"], + apiSecret: req.variables["API_SECRET"], + }); + const vonage = new Vonage(credentials, options); + + + const { + from, + to, + text, + } = JSON.parse(req.payload); + try { + const resp = await vonage.sms.send({ to, from, text }); + console.log('Message sent successfully'); console.log(resp.messages[0].status); + + } catch (error) { + console.log(error); + } + + +}; + + + +