From this article you will learn:
- What is a Rossum Serverless Function
- How to create a Serverless Function
- What are the available triggers
- How to make your function work
- How to assign a Serverless Function to a queue
- What are the limitations of a Serverless Function
Have you ever thought of showing your data capture reviewers a customized message? Or perhaps you have thought of calculating fields like tax rates from other values in the document? You can perform these actions with a Rossum extension, such as a webhook. However, webhooks have a limitation – you need to manage your computing resources, such as a web server. Fortunately, there is a Rossum extension type that overcomes this limitation: a Rossum Serverless Function.
What is a Rossum Serverless Function?
With a Rossum Serverless Function, you can write a piece of code that receives data from a document you are currently reviewing. Based on such data, the function can return messages or data updates to Rossum UI. And all this is done without the need for your own web server. Rossum executes everything for you.
Below is a list of use cases where a function can be helpful:
- Displaying a custom message to the user in the validation screen,
- Using the captured data to calculate missing values in a document,
- Postponing a document and notifying your domain expert to review it if there appear to be discrepancies,
- Fine-tuning the exporting process to your ERP once a document has been confirmed.
How to create a Serverless Function
Creating a new Serverless Function is very straightforward; follow the steps below:
- Hover your cursor over the Extensions button at the top of your screen, and select “My extensions.”
- Click on the “Create extension” button.
- Name your extension (you can also add a description if needed).
- Select the event’s actions when the Serverless Function is triggered.
- Choose the Queues to which you want to add this new function.
- For the Extension type, select “Custom Function.”
- Click on the “Create the function and start coding.” button.
What are the available triggers
When creating a Serverless Function, you must define a set of events when the function is triggered. You can choose from various available triggers:
- Email – Received
- Filter out non-relevant documents that Rossum should not process.
- Document status – Changed
- Trigger a specific action in your workflow when the document’s status changes.
- Document content – Initialize
- Update the document’s data right when it gets processed by the AI Engine. For example, match the captured vendor name to master data before the user opens the document.
- Document content – User Update
- Show a custom message to the user when they update the field value in the validation screen.
- Document content – Export
- Send the verified data to the ERP/AP system when a user clicks on the “Confirm” button.
Note: Read a more technical guide about Functions.
How to make your function work
Your function needs code that defines its behavior. That is why we have created a function code editor. You will see it when you make a new Serverless Function.
Otherwise, you can access the editor by going to My extensions, selecting the appropriate function, and then clicking the Edit code button.
How to assign a Serverless Function to a queue
The last step before seeing the function in production is assigning the Serverless Function to a queue. You can do so while creating a new function.
However, later on, you may want to add this new function to different queues as well. In such a case, you have two ways to do so.
Assign a Serverless Function using Extensions
It is an efficient way to assign a function to multiple queues simultaneously.
- Navigate to My Extensions tab.
- Click on the function you want to assign.
- In the function window, choose the queues to which you want to add this function.
Assign a Serverless Function within the queue
It is useful when you want to add a serverless function to only one specific queue.
- Open the required queue.
- Navigate to the Queue’s Settings and select Extensions.
- Choose the “Attach extension” option.
- Select the serverless function to enable on that queue.
What are the limitations of Serverless Functions
If you compare Rossum extensions based on Serverless Functions to Webhooks, they are easier to configure and deploy. Yet, Webhooks still have their place when building a larger-scale extension. You should choose Webhooks interface when:
- your extension requires network access (e.g., to external ERPs) or database resources.
- your extension contains so much code it should be versioned and split into several files.
In the future, we will definitely work on making Serverless Functions even more powerful and will do our best to remove these limitations.
Note: Serverless Functions are enabled for all trial accounts and certain paid plans. If you are not seeing Serverless Functions in your account, please contact us at email@example.com to discuss extension of your current plan.
Note: Read more about serverless functions on our developer hub.
Examples of Custom Functions
Rossum can already offer some examples of custom functions: