Serverless Add-ons

Serverless add-ons are implemented as Simple Functions hosted by ServiceM8.

ServiceM8 hosts Simple Function Add-ons on its infrastructure, so you can build add-ons without needing to manage any server resources.

Simple Function Add-on

Set up your add-on as a Simple Function Add-on and ServiceM8 will manage all infrastructure requirements. You supply the code; we run it. The recommended way to build and deploy a Simple Function Add-on is the Addon Kit CLI, which bundles TypeScript and npm dependencies and deploys from your terminal. You can also edit the code in the browser by clicking the Edit Function button in your Add-on's settings page. Refer to Event Data for more information about the arguments provided to your function when it's invoked.

Your Simple Function must be written in NodeJS v24, if you would prefer to use Python, C# or Java you'll need to use a Web Service hosted add-on instead.

Your add-on should use structured JSON logs, with one JSON object per line containing a log level, message, and relevant context. See Structured JSON logging for an example you can use in your function.

Account preferences

ServiceM8-hosted Simple Functions can declare up to 10 static settings in the manifest's preferences array. Users edit them in Settings → Preferences → Add-ons, and your function reads their account-specific values from event.preferences. This capability is not available to functions hosted in your own AWS account or to web-service Add-ons.

ServiceM8 Secure Token Service

The ServiceM8 Secure token service simplifies the process of add-ons being able to communicate with the ServiceM8 API via OAuth. Normally, API integrations are required to complete the OAuth authentication flow, and then manage their OAuth access token, refreshing the token periodically. However, to reduce the burden of managing access tokens within a serverless environment ServiceM8 can automatically issue your add-on with a short-lived access token (900 seconds) for each invocation of your Simple Function.

The access token is provided as part of the event data for each request , and can be used immediately to read and write data from ServiceM8 APIs. The access token is scoped to the OAuth scope you specify in your add-on manifest file.


What’s Next

See the event data that's supplied when your Simple Function is invoked.

Did this page help you?