-
Notifications
You must be signed in to change notification settings - Fork 1
/
google-gcs-slack.js
51 lines (42 loc) · 1.08 KB
/
google-gcs-slack.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
'use strict'
const rp = require('request-promise')
const scene = {
url: 'https://google.com',
selector: 'img#hplogo',
dom_index: 0,
viewport: {width: 900, height: 700}
}
const storage = {
type: 'gcs',
project_id: 'your_project_id',
bucket: 'your_bucket',
credentials: {
client_email: '[email protected]',
private_key: '-----YOUR PRIVATE KEY STRING -----'
},
path: 'test/folder',
how_long: {
unit: 'years', // units from here https://momentjs.com/docs/#/get-set/set/
period: 2
}
}
const markets = [{
type: 'slack',
webhook_url: 'https://hooks.slack.com/services/your/webhook/url',
title: 'title',
text: 'text',
footer: 'footer'
}]
const body = { markets, storage, scene }
(async () => {
const host = 'http://scene-stealer.server:port' // replace with your scene-stealer server/container url
const options = {
method: 'POST',
uri: `${host}/take`,
body,
json: true
}
const result = await rp(options)
console.log(result)
// and check your slack channel if the message has arrived with the screenshot
})()