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.assets;
            'http://my.own.api/assets-update', {json: true, body: {assets}});

Anatomy of the cloud code

Your cloud code should export a function with one argument—the event to handle. It looks like this:

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

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

cloud.enqueue('assets-update', {assets: ['...']);

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 10.x environment, with access to the following modules only:

(You still need to require them before use.)

Note: The versions of these packages are guaranteed to be at least as stated above, but we might update them as per the ^ npm specifier—that is, patch and minor version updates, but not the major version.

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: