Importing NPM Packages to functions
Overview
NPM is a package manager for JavaScript that makes it easy to share and reuse code.
Through Glassix functions, you can import and use node third-party libraries inside your code. This helps reduce the need to write code.
Limitations
- You can add up to 5 NPM packages per function.
- Your entire function's size (including code and packages) can't be more than 50MB (compressed)
Add an NPM Package
-
Go to Settings.
Click on the symbol in the agent dashboard.
-
Click on Developers → Functions. Click here
-
Click Add New Function.
-
Fill Function Name and select Category, Type, and Timeout → Click Create.
-
Connect the function to a chatbot flow or a Webhook.
Info
Learn more about connecting your functions to a chatbot here or to a Webhook here.
- Switch to your function's Settings tab.
- Under the Import npm modules into your application section:
- In the Module text box, type a valid name of an NPM package.
- From the Version drop-down, select your desired version.
- Click Add
- Click Save.
Success:
You can now use the packages you've imported.
Updated about 1 year ago