Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function notify(updatedRecords: any[]) {
const url = process.env.SLACK_WEBHOOK_URL
if (!url || url.length === 0) throw Error('You have to specify the SLACK_WEBHOOK_URL in your environment variables')
return request.post(url, {
json: {
channel: '#immo-feed',
username: 'immo-feed',
text: `:house: ${updatedRecords.length} new result(s) found`,
icon_emoji: ':house:'
}
})
.then(() => console.log('🔔 Slack notification sent'))
.catch(err => console.log('🔔 Slack notification failed'))
}
it('should fail creating a job with an invalid name', (done) => {
const options = Object.assign({}, masterKeyOptions, {
body: {
job_schedule: {
jobName: 'job'
}
}
});
rp.post(Parse.serverURL + '/cloud_code/jobs', options)
.then(done.fail)
.catch(() => done());
});
function refreshAccessToken(client_id, client_secret, refresh_token) {
return request.post("https://www.googleapis.com/oauth2/v4/token", {
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
form: {
client_id: client_id,
client_secret: client_secret,
refresh_token: refresh_token,
grant_type: "refresh_token",
}
});
}
createNewUser() {
return RP.post(this.baseUrl, {
json: true,
body: {
devicetype: `VSCodeExtension#Hue`
}
}).then(HandleSuccessResponse);
}
}