LTE Beacon: Cloud code & APIs

LTE Beacon sends its events to Estimote Cloud, where you can:

  • process it immediately, by writing some cloud code that runs directly in Estimote Cloud
  • retrieve it later via Estimote Cloud API

What’s ahead (aka Table of Contents)

Cloud code

Each IoT App is not just the code that runs on the LTE Beacon, but also code that runs in Estimote Cloud, where you can handle the events coming from the LTE Beacon. We call the latter cloud code, and you’ll commonly use it to call other APIs in response to the LTE Beacon events.

Here’s an example:

const request = require('request-promise');
module.exports = async function (event) {
    if (event.type === 'assets-update') {
        const assets = event.payload;
            'http://my.own.api/assets-update', {json: true, body: {assets}});

Anatomy of the cloud code

Your cloud code should export a function that can receive up to 2 parameters:

  1. An object describing the event, which looks like this:

    {"type": "assets-update",
     "payload": ["1a15b246a7190f625c4fdbf29b030f06",
     "enqueuedAt": "2018-10-30T13:27:23.170Z",
     "identifier": "5e7e309e594c26a4d0694a90698c7534"}

    … which corresponds to the following event queued on the LTE Beacon:

    cloud.enqueue('assets-update', ['1a15b246a7190f625c4fdbf29b030f06',
  2. [optional] A parameter-less callback function to call upon completion.

Your function is expected to either:

  • be an async function, for example:

      module.exports = async function (event) {
          await twilio.messages.create({ /* ... */});
  • return a Promise, for example:

      module.exports = function (event) {
          return twilio.messages.create({ /* ... */});

Execution limits

Your functions must finish within 30 seconds, and has very limited amount of memory and processing power.

Node.js environment & available modules

Your function will run in a sandboxed Node.js 8.x environment, with access to the following modules only:

(You still need to require them before use.)

LTE Device Events API

You can access the history of events from your LTE Beacons via Estimote Cloud API.

The appropriate endpoint is documented here: