Cloud Execution by webhook

Cloud execution can also be triggered by webhooks, so if something happens on a service like IFTTT or Slack, you can skip the webhook to the obniz app and launch the app.

Settings.

To enable webhooks, go to the app settings, "Cloud Execution" and check "Run with Webhooks".

Once you install the enabled app, the webhook URL will appear on the device's admin screen.

webhooks support GET and POST.

query and body

You can retrieve the query and body (in the case of POST) when the webhook is hit from the program.

documentation

if (Obniz.App.isCloudRunning()) {
  const req = Obniz.App.req();
  console.log(req.query);
  console.log(req.body);
  Obniz.App.done({
    status: 'success',
    text: `Webhook called`
  })
}