Skip to content
This repository was archived by the owner on May 2, 2021. It is now read-only.

Commit 89b0e8b

Browse files
committed
deploy functions
1 parent 2bca50a commit 89b0e8b

File tree

4 files changed

+70
-28
lines changed

4 files changed

+70
-28
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ img/uploads
1010
# TODO: Import ignores from: https://www.gitignore.io/api/jekyll,node,windows,linux,macos,ruby,webstorm
1111

1212
convert
13+
14+
# Local Netlify folder
15+
.netlify
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const axios = require('axios');
2+
3+
const { ONE_SIGNAL_API_KEY, ONE_SIGNAL_APP_ID } = process.env;
4+
5+
exports.handler = async function (event) {
6+
axios.post(
7+
'https://onesignal.com/api/v1/notifications',
8+
{
9+
included_segments: ['Active Users'],
10+
app_id: ONE_SIGNAL_APP_ID,
11+
headings: {
12+
en: 'Pubblicato un nuovo evento!',
13+
},
14+
contents: {
15+
en: "Titolo dell'evento",
16+
},
17+
},
18+
{
19+
headers: { Authorization: `Basic ${ONE_SIGNAL_API_KEY}` },
20+
},
21+
);
22+
return {
23+
statusCode: 200,
24+
};
25+
};

package-lock.json

Lines changed: 41 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"prettier": "^2.2.1"
2929
},
3030
"dependencies": {
31+
"axios": "^0.21.1",
3132
"workbox-routing": "^6.0.2",
3233
"workbox-strategies": "^6.0.2"
3334
}

0 commit comments

Comments
 (0)