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

  1. You can add up to 5 NPM packages per function.
  2. Your entire function's size (including code and packages) can't be more than 50MB (compressed)

Add an NPM Package

  1. Go to Settings.

    Click on the symbol in the agent dashboard.

  2. Click on DevelopersFunctions. Click here

  3. Click Add New Function.

  4. Fill Function Name and select Category, Type, and Timeout → Click Create.

  5. 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.

  1. Switch to your function's Settings tab.
  2. Under the Import npm modules into your application section:
    1. In the Module text box, type a valid name of an NPM package.
    2. From the Version drop-down, select your desired version.
    3. Click Add
  3. Click Save.

👍

Success:

You can now use the packages you've imported.


What’s Next

Import our Glassix SDK