ServiceM8 Add-ons can be built without needing to manage any server resources, and can be either directly hosted on ServiceM8's infrastructure, or by using AWS Lambda. AWS Lambda is a serverless compute service that automatically manages the underlying compute resources for you, from a few requests per day to thousands per second.
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. To edit your code, click 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 v12, if you would prefer to use Python, C# or Java you'll need to use a Web Service hosted add-on instead.
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 Lambda 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.
Updated about 4 years ago