Triggers allow your DroneDeploy App to respond to events happening on the DroneDeploy Platform. For example, you may want to kick off a pre-defined export once your map completes processing.
Triggers are associated with an App's Function. In order for a Trigger event to fire, the user who triggered the event needs to have the App installed, and the Function should have a Trigger defined. You can define Triggers using the DroneDeploy CLI
and the serverless.yml
file. For example:
service: IFTTT​provider:name: dronedeploy​app: # APP ID GOES HERE​plugins:- "@dronedeploy/dronedeploy-cli"​functions:ifttt-webhook:handlerPath: functions/webhookhandler: dronedeploymemory: 128events:-triggerobject-type: Exporttype: completeresources:tables:webhook-table:description: "stores endpoint for IFTTT webhook"columns:- name: endpointtype: Textencrypted: falselength: 255description: "webhook endpoint for IFTTT"
Currently there is a reserved path under /__ddtriggerfunction
on each DroneDeploy Function for listening to Trigger events.
Your code might look something like this:
exports.routeHandler = function (req, res, ctx) {const path = req.path;switch(path) {case '/__ddtriggerfunction':triggerHandler(req, res, ctx);break;}};
You can check out our sample app to see how Triggers are handled.
We currently support the following Triggers:
Export:complete
MapPlan:complete