[SOLVED] Purpose of Functions?

I’m exploring and learning about the Ubidots platform. What is the purpose of functions? It seems like functions just, in the end, send a request to https://industrial.api.ubidots.com/api/v1.6/devices. So why not just send my original request to that URL instead of the URL for my function?

Hi @omep-developer,

The UbiFunctions module is a FaaS (Functions as a Service) feature built-in directly into Ubidots. It allows to exploit the power of high level programming languages such Python and NodeJS to develop your own scripts that can:

  1. Serve as a custom API endpoint. This is particular useful when your making cloud-to-cloud integrations where the sent payload (JSON or hexadecimal frame) isn’t compatible with Ubidots. You’d first send the data to a function, parse it and convert it to an Ubidots compatible JSON to finally post it to your account through the /devices endpoint, just as you’ve pointed out. Examples include connecting LoRaWAN devices through a Network Server (TheThingsStack is one), or Sigfox devices.
  2. Perform analytics that aren’t included in the Synthetic variables modules using the data stored in your devices.
  3. Connect with other platforms.

This article might help provide additional clarification

1 Like

@dsr Ah, I see. It’s a layer of indirection for integrating, enhancing/adding features to a data payload, and… pretty much anything since it’s FaaS. Very neat, I love this choice by Ubidots and how it sits in the architecture/ecosystem.

Thank you for the explanation.