Service to send mail if there are new openings
6.4K
Sends mail if there are new openings
You'll need a SendGrid account and an API-key.
You'll need an API for recruitments similiar to the one used by Telemark fylkeskommune.
$ git clone [email protected]:telemark/tfk-recruitment-sendmail.git
$ npm run setup
$ npm test
'use strict'
var recruitmentsSendMail = require('tfk-recruitment-sendmail')
var options = {
apiKey: 'your-sendgrid-api-key',
apiUrl: 'https://api.t-fk.no/recruitments',
mailTo: '[email protected]',
mailFrom: '[email protected]',
mailCc: '[email protected]'
}
recruitmentsSendMail(options, function (error, data) {
if (error) {
console.error(error)
} else {
console.log(data)
}
})
Example of returned data
Found a total of 11 jobs
This job is fresh! https://hrm.btvregion.no/tfk_recruitment/jobid/2633
This job is previously published: https://hrm.btvregion.no/tfk_recruitment/jobid/2665
This job is previously published: https://hrm.btvregion.no/tfk_recruitment/jobid/2666
This job is previously published: https://hrm.btvregion.no/tfk_recruitment/jobid/2662
This job is previously published: https://hrm.btvregion.no/tfk_recruitment/jobid/2638
This job is previously published: https://hrm.btvregion.no/tfk_recruitment/jobid/2639
This job is previously published: https://hrm.btvregion.no/tfk_recruitment/jobid/2656
This job is previously published: https://hrm.btvregion.no/tfk_recruitment/jobid/2651
This job is previously published: https://hrm.btvregion.no/tfk_recruitment/jobid/2652
This job is previously published: https://hrm.btvregion.no/tfk_recruitment/jobid/2654
This job is previously published: https://hrm.btvregion.no/tfk_recruitment/jobid/2655
Mail delivered
{"message":"success"}
{ jobsDone: 11, newJobs: 1, oldJobs: 10 }
To run this module as a service use the docker image.
Change the ENV parts of the Dockerfile or use docker.env
Build
$ docker build -t tfk-recruitment-sendmail .
Run a container
$ docker run --rm tfk-recruitment-sendmail
or
$ docker run --env-file=docker.env --rm tfk-recruitment-sendmail
This will spin up a container. Do the jobs. Shut it down and remove it.

Content type
Image
Digest
Size
28.7 MB
Last updated
over 9 years ago
docker pull telemark/tfk-recruitment-sendmail:master