WebhookJob constructor
Get the ID.
Check if job is locally available.
Set if the job is locally available.
Get the _name.
Set a new _name.
Get the _name proper.
Get the HTTP request object.
Get the HTTP response object.
Get if the response to the webhook was already sent or not.
Set if the response to the webhook was already sent or not.
Create a new life event.
Sends an email.
Email options
// my_tunnel.js
tunnel.run(function (job, nest) {
job.email({
subject: "Test email from pug template",
to: "john.smith@example.com",
template: __dirname + "./template_files/my_email.pug"
});
});
// template_files/my_email.pug
h1="Example email!"
p="Got job ID " + job.getId()
tunnel.run(function (job, nest) {
job.email({
subject: "Test email with hard-coded plain-text",
to: "john.smith@example.com",
text: "My email body!"
});
});
tunnel.run(function (job, nest) {
job.email({
subject: "Test email with hard-coded html",
to: "john.smith@example.com",
html: "<h1>My email body!</h1>"
});
});
Function to call to fail a job while in a tunnel.
Get a string from the request body. The given callback is given a string parameter.
webhookJob.getDataAsString(function(requestBody){
console.log(requestBody);
});
Returns FileJobs made from _files sent via FormData to the webhook.
Get a single FormData value.
Get all FormData values.
Get the job object as JSON with circular references removed.
Returns a parameter from both the query string and form-data.
Returns an array of parameters from both the query string and form-data.
Get the entire job property object.
Get the type of a property.
job.setPropertyValue("My Job Number", 123456);
console.log(job.getPropertyType("My Job Number"));
// "number"
Get the value of a property if it has been previously set.
Return a specific URL parameter.
// Webhook URL: /hooks/my/hook?customer_id=MyCust
var customer_id = webhookJob.getUrlParameter("customer_id");
// customer_id => MyCust
Return all URl parameters.
// Webhook URL: /hooks/my/hook?customer_id=MyCust&file_name=MyFile.zip
var query = webhookJob.getUrlParameters();
// query => {customer_id: "MyCust", file_name: "MyFile.zip"}
Add a message to the log with this job as the actor.
0 = debug, 1 = info, 2, = warning, 3 = error
Log message
Move function error.
Packs the job instance and file together in a zip. Returns a PackJob in the parameter of the callback.
job.pack(function(packJob){
packJob.move(packed_folder_nest);
});
Attach job specific data to the job instance.
job.setPropertyValue("My Job Number", 123456);
console.log(job.getPropertyValue("My Job Number"));
// 123456
Class _name for logging.
Transfer a job to another tunnel directly.
Unpacks a packed job. Returns a the original unpacked job in the parameter of the callback.
packedJob.unpack(function(unpackedJob){
console.log("Unpacked", unpackedJob.name);
unpackedJob.move(unpacked_folder);
packedJob.remove();
});
Generated using TypeDoc
A job that is triggered when a webhook receives a request.