This article is part of the Insightly Automation Guide
To get your Lambda function up and running in Insightly, you'll need to create the function, then set the trigger for it. There are two types of triggers:
- A timed trigger which runs the function every hour or every day
- A workflow action, which triggers the function when certain criteria that you specify are met in Insightly
You may add up to 50 functions to your account.
To create a Lambda function:
- Go to System Settings > Lambda Functions.
- Click New Function.
- Enter a name and a short description for the function.
- Choose the Runtime language you've used to write your code.
- Enter the Handler Name.
- When you choose Node.js or Python, you can choose Edit Code Inline or Upload a .ZIP file. Java and C# only offer the upload option, so you'll skip the next step.
- If you choose Edit Code Inline, write or copy your code in the field that appears further down the page.
When your function references an Insightly object, structure the payload in the following way. Refer to our API documentation for all available fields and record types.
"SALUTATION": "Your Honor",
"ORGANIZATION_NAME": "The Court",
- If you choose Upload a .ZIP file, click Upload to select and upload your package file. The package must be less than 50MB in size.
- Enter Environment Variables. Click Add New Variable to add more than one.
A few notes on variables:
- The total size of your set of variables cannot exceed 4 KB
- Package all dependencies into your Lambda function code
- Each one must start with letters [a-zA-Z]
- Fields can only contain alphanumeric characters and underscores ([a-zA-Z0-9_]
- Click Save Function.
- Your new function will now appear in the Lambda Functions list.
- Now that your function is active, you'll be able to select it from the Actions menu when creating a workflow.
- To add an hourly or daily timer, click the function's name.
- Click Add Scheduled Trigger for Function.
- Choose whether to run the function every hour or every day at a specific time and click Save Schedule.
When you view the function, you can see the workflows and schedules that trigger it. Functions will be set with a 30 second timeout. If a function fails to run 3 consecutive times, it will be automatically disabled.