Webtask

Documentation

Parameterizing Webtask Code

URL query parameters are propagated to webtask code

For customized documentation and ready to run samples, please log in.

You can pass paramaters to the webtask code using URL query string of the webtask request. All URL query parameters will be propagated to the webtask code when it runs. To take advantage of this feature, define your JavaScript function such that it accepts two arguments instead of one: the context and the callback, e.g:

module.exports = function(context, callback) {
  callback(null, "Hello, " + context.query.name);
}        

All allowed URL query parameters of the webtask request will be provided to the webtask code in the form of context.data JavaScript object.

You can try it out with curl as follows:

curl https://sandbox.auth0-extend.com/api/run/{webtask_container}?name=Tomek -H "Authorization: Bearer {webtask_token}" --data-binary 'module.exports = function(context, cb) { cb(null, "Hello, " + context.query.name); }'