# NodeJS -------------------------------------------------------------------------------- title: "Introduction" description: "Configure a conversational sales assitant bot for an ecommerce website using Catalyst ConvoKraft, Serverless Integration functions, and Zoho CRM that will interact with the website users, and manage their orders." last_updated: "2026-03-18T07:41:08.676Z" source: "https://docs.catalyst.zoho.com/en/tutorials/ecommerce-bot/nodejs/introduction/" service: "All Services" related: - Catalyst ConvoKraft Actions (/en/convokraft/help/actions/overview/introduction) - Catalyst ConvoKraft Handlers (/en/convokraft/help/handlers/welcome-message-handler) - Catalyst Serverless Functions (/en/serverless/help/functions/introduction/) - Catalyst CloudScale Web Client Hosting (/en/cloud-scale/help/web-client-hosting/introduction/) -------------------------------------------------------------------------------- # Ecommerce Bot ### Introduction This tutorial will help you build an ecommerce bot through {{%link href="/en/convokraft/" %}}Catalyst ConvoKraft{{%/link%}} that serves as an efficient sales assistant for your ecommerce website. Consider an online store that sells electronic gadgets and appliances through its website. We will be building a {{%link href="/en/convokraft/help/bots/introduction/" %}}ConvoKraft bot{{%/link%}} for the website that allows users to have engaging one-to-one conversations any time, without having to raise support tickets or contact customer care personnel for simpler, straightforward queries or frequently asked questions. The ecommerce bot can display the list of products available in the store's inventory, enable users to place an order with the store, view the details of an order, change the delivery address, or reschedule the tentative delivery of the order. The ecommerce bot will look like this after it is embedded in the website : You can access a working ecommerce bot and test its functioning here: {{%link href="https://ecommerce.catalystserverlessapp.com/app/" %}}Try the App!{{%/link%}} The ecommerce bot uses the following fundamental ConvoKraft components: * **{{%link href="/en/convokraft/help/actions/overview/introduction" %}}Actions{{%/link%}}** : We will be configuring the ecommerce bot to perform operations such as viewing the list of items available in the online store, placing an order, viewing details of an order, changing the delivery address and rescheduling the delivery date. * **Bot Logic** : We will be configuring the bot logic of our ecommerce bot using {{%link href="/en/convokraft/help/actions/bot-logic/catalyst-integration-functions/" %}}Catalyst Integration Functions{{%/link%}}. The function will handle the backend logic of the actions that are configured. In this tutorial, we have coded the functions in {{%bold%}}Node.js16{{%/bold%}}. * **{{%link href="/en/convokraft/help/handlers/welcome-message-handler" %}}Handlers{{%/link%}}** : We will be configuring responses in the handler functions to greet the user while initiating a fresh conversation with the bot, to intimate the user on scenarios of failure or exceptions, and also to let the user know the bot is unable to comprehend a particular message. The core execution logic of the bot will also be configured in a handler function and we will be discussing more about it in {{%link href="/en/tutorials/ecommerce-bot/nodejs/configure-function/" %}}this section{{%/link%}}. {{%note%}}{{%bold%}}Note:{{%/bold%}} Integration Functions is currently not available to Catalyst users accessing from the EU, AU, IN, or CA data centers. Users accessing from these DCs can instead build the bot logic with the Deluge function option.{{%/note%}} The ConvoKraft bot also uses other Catalyst services and their components including : 1. {{%link href="/en/serverless/getting-started/introduction/" %}}**Catalyst Serverless**{{%/link%}}: - **{{%link href="/en/serverless/help/functions/introduction/" %}}Functions{{%/link%}}** : We will be using the {{%link href="/en/convokraft/help/actions/bot-logic/catalyst-integration-functions/" %}}Catalyst Integration function{{%/link%}} and code the ConvoKraft bot logic in it and then associate the created function with our ConvoKraft bot. 2. {{%link href="/en/cloud-scale/getting-started/introduction/" %}}**Catalyst Cloud Scale**{{%/link%}}: - **{{%link href="/en/cloud-scale/help/web-client-hosting/introduction/" %}}Web Client Hosting{{%/link%}}** : For {{%link href="/en/cloud-scale/help/web-client-hosting/implementation/" %}}hosting the client application{{%/link%}}, i.e., the website, we will use this component of the {{%link href="/en/cloud-scale/" %}}Catalyst Cloud Scale{{%/link%}} service. We will be embedding the bot in the website using the front-end {{%link href="/en/convokraft/sdk/js/overview/" %}}Javascript SDK{{%/link%}} package provided by Catalyst. We will also be configuring the following Zoho service: * **{{%link href="https://www.zoho.com/en-in/crm/" %}}Zoho CRM{{%/link%}}** : For storing the products in the online store and the data of all the orders placed, we will be creating custom modules in Zoho CRM and use it as our data source. To learn more about configuring custom modules, please refer to {{%link href="/en/tutorials/ecommerce-bot/nodejs/create-custom-modules-in-crm/" %}}this section{{%/link%}}. In this tutorial, you will be given the code to build the ConvoKraft bot using Catalyst Integration functions and a simple client code for the ecommerce website. You will just have to copy the code given here and paste it into the appropriate files as directed. We will be configuring the required actions for the bot, coding the business logic, training and testing the bot, and finally embedding the bot in the website. -------------------------------------------------------------------------------- title: "Prerequisites" description: "Create a simple web application using the features of Catalyst Authentication that provides user sign-up, application login, password reset, and implements Zoho and Google sign-in providers." last_updated: "2026-03-18T07:41:08.676Z" source: "https://docs.catalyst.zoho.com/en/tutorials/ecommerce-bot/nodejs/prerequisites/" service: "All Services" related: - Login Zoho CRM (https://www.zoho.com/en-in/crm/) - CLI Command Reference (/en/cli/v1/cli-command-reference/) - Install CLI (/en/getting-started/installing-catalyst-cli/) - Login CLI (/en/cli/v1/login/login-from-cli/) -------------------------------------------------------------------------------- # Prerequisites Before you begin building the application, you must have the following prerequisites installed on your system: 1. {{%bold%}}Catalyst CLI{{%/bold%}}: Catalyst CLI contains a host of tools that enable you to initialize, develop, test, and deploy the components of your application from your local machine. We will be working with Catalyst CLI in this tutorial. You must perform these actions: 1. {{%bold%}}Install Catalyst CLI{{%/bold%}}: Catalyst CLI is installed through NPM. You must therefore have NPM and Node.js installed on your system before you install the CLI. Refer to the {{%link href="/en/getting-started/installing-catalyst-cli/" %}}**Install Catalyst CLI help page**{{%/link%}} for details on the pre-requisites and the steps to install it. 2. {{%bold%}}Login Catalyst CLI{{%/bold%}}: After you install Catalyst CLI, you must authenticate the CLI with your Catalyst account before using it. Refer to the {{%link href="/en/cli/v1/login/login-from-cli/" %}}**CLI Login help page**{{%/link%}} for the steps to log in from Catalyst CLI and the various options available for it. 2. {{%bold%}}Any IDE tool for Node.js and client code development{{%/bold%}}: Download and install an IDE of your choice in your system. You can use any IDE to work with the function and the client code. Some popular choices include Visual Studio Code, IntelliJ IDEA, Eclipse, and Sublime Text. {{%info image="/images/tutorials/todo-list/vscode.png"%}}If you are a Visual Studio Code IDE user, you can install the {{%bold%}}Catalyst Tools{{%/bold%}} extension, and use your IDE itself in place of the CLI. You can find more details about the Catalyst VS Code extension from this {{%link href="/en/catalyst-extensions/vs-code-extension/introduction/" %}}help section{{%/link%}}.{{%/info%}} 3. {{%bold%}}Zoho CRM account{{%/bold%}} : You will need to have a configured Zoho CRM account of any edition as the data source of the product inventory and orders for the ecommerce store. If you don’t have a Zoho CRM account, you can sign up for it {{%link href="https://www.zoho.com/en-in/crm/" %}}here{{%/link%}}. -------------------------------------------------------------------------------- title: "Create a project" description: "Configure a conversational sales assitant bot for an ecommerce website using Catalyst ConvoKraft, Serverless Integration functions, and Zoho CRM that will interact with the website users, and manage their orders." last_updated: "2026-03-18T07:41:08.676Z" source: "https://docs.catalyst.zoho.com/en/tutorials/ecommerce-bot/nodejs/create-a-project/" service: "All Services" related: - Catalyst ConvoKraft (/en/convokraft/) - Catalyst Project Creation (/en/getting-started/catalyst-projects/#create-a-catalyst-project) -------------------------------------------------------------------------------- # Create a project Let's first {{%link href="/en/getting-started/catalyst-projects/#create-a-catalyst-project" %}}create a Catalyst project{{%/link%}} from the {{%link href="https://console.catalyst.zoho.com/baas/index" %}}Catalyst console{{%/link%}}. 1. Log in to the {{%link href="https://console.catalyst.zoho.com/baas/index" %}}Catalyst console{{%/link%}} and click {{%bold%}}Create new Project{{%/bold%}}. <br/> 2. Enter the project's name as "**Ecommerce**" in the pop-up window that appears. <br/> 3. Click {{%bold%}}Create{{%/bold%}}. Your project will be created and opened. <br/> We will be using the {{%link href="/en/convokraft/" %}}Catalyst ConvoKraft{{%/link%}} service for this tutorial. -------------------------------------------------------------------------------- title: "Create a bot" description: "Configure a conversational sales assitant bot for an ecommerce website using Catalyst ConvoKraft, Serverless Integration functions, and Zoho CRM that will interact with the website users, and manage their orders." last_updated: "2026-03-18T07:41:08.713Z" source: "https://docs.catalyst.zoho.com/en/tutorials/ecommerce-bot/nodejs/create-a-bot/" service: "All Services" related: - Catalyst Integration Functions (/en/convokraft/help/actions/bot-logic/catalyst-integration-functions) -------------------------------------------------------------------------------- ### Create a bot Let's begin by {{%link href="/en/convokraft/help/bots/create-a-bot/" %}}creating a bot{{%/link%}} in ConvoKraft: 1. Navigate to the {{%bold%}}ConvoKraft service{{%/bold%}} icon in the left pane of the {{%link href="https://console.catalyst.zoho.com/baas/index" %}}Catalyst console{{%/link%}}. Click {{%bold%}}Start Exploring{{%/bold%}}. <br /> 2. Click {{%bold%}}Create New Bot{{%/bold%}}. 3. In the {{%bold%}}Create New Bot{{%/bold%}} pop-up, enter the name of the bot as "EcommerceBot". Provide a short description of the bot and also an icon for your bot, if required. <br /> 4. Click {{%bold%}}Save{{%/bold%}}. In the page that follows, choose the development platform upon which you would like to build the business logic of your bot. In this tutorial, we will be coding our backend logic using Catalyst Integration {{%bold%}}Functions{{%/bold%}}. To learn more about Catalyst Integration functions in detail, please refer to {{%link href="/en/convokraft/help/actions/bot-logic/catalyst-integration-functions" %}}this page{{%/link%}}. <br /> You must select the integration function to be associated with your ConvoKraft bot by clicking on the {{%bold%}}Select function{{%/bold%}} dropdown. We will be creating the integration function in the {{%link href="/en/tutorials/ecommerce-bot/nodejs/configure-function/" %}}later sections{{%/link%}} of this tutorial. {{%note%}}{{%bold%}}Note:{{%/bold%}} You can just choose {{%bold%}}Function{{%/bold%}}, click {{%bold%}}Save{{%/bold%}} now, and associate the corresponding integration function later in the Bots details page.{{%/note%}} -------------------------------------------------------------------------------- title: "Configure Actions" description: "Configure a conversational sales assitant bot for an ecommerce website using Catalyst ConvoKraft, Serverless Integration functions, and Zoho CRM that will interact with the website users, and manage their orders." last_updated: "2026-03-18T07:41:08.714Z" source: "https://docs.catalyst.zoho.com/en/tutorials/ecommerce-bot/nodejs/configure-actions/" service: "All Services" related: - Create ConvoKraft bot (/en/convokraft/help/bots/create-a-bot/) - Create Action (/en/convokraft/help/actions/create-an-action/) -------------------------------------------------------------------------------- # Configure Actions After {{%link href="/en/convokraft/help/bots/create-a-bot/" %}}creating the bot{{%/link%}}, you will need to {{%link href="/en/convokraft/help/actions/create-an-action/" %}}create actions{{%/link%}} and configure the responses of those actions as required. You can generally choose to configure the response of an action to be either based on a business logic or a static direct response without involving any operation. In this tutorial, the response of all actions will be configured based on the execution of a business logic. We will be creating the following set of actions for the ecommerce bot, so that the users can directly interact with the bot and perform actions whenever they need. * **To list the products in the ecommerce store** * **To place a new order** * **To view the details of an order** * **To change the delivery address** * **To reschedule the order to a later date** In order to configure an action based on your application's specific needs, you must define the appropriate sample sentences and params for it. In this section, we will be discussing in detail about the {{%link href="/en/convokraft/help/actions/define-sample-sentences/" %}}sample sentences{{%/link%}} and {{%link href="/en/convokraft/help/actions/define-params/" %}}params{{%/link%}} to be configured for the actions mentioned above for your ecommerce bot. After you {{%link href="/en/tutorials/ecommerce-bot/nodejs/create-a-bot/" %}}create a ConvoKraft bot{{%/link%}} and choose the appropriate development platform to build the business logic, the bot's details page will be displayed. Follow the steps listed below to create and configure actions for the ecommerce bot: 1. Click {{%bold%}}Create Action{{%/bold%}} after you open the bot to add a new action. <br /> 2. We will create the first action for our ecommerce bot to list the items available in the store. In the pop-up window that opens, provide the name of the action as "List the items available in Store". Select the response as {{%bold%}}Based on a business logic{{%/bold%}}, then click {{%bold%}}Next{{%/bold%}}. <br /> 3. Configure the applicable sample sentences. In a conversational way, the user would prompt this action in many ways, such as "list the items available" or "what are the products available in the store?". <br /> 4. We will not be configuring any params for this action. You can therefore skip this step and proceed to click {{%bold%}}Save{{%/bold%}}. <br /> Similarly, the steps to create the remaining actions of the ecommerce bot are given below. The steps mentioned above will apply to all actions, and additionally you might be required to {{%link href="/en/convokraft/help/actions/define-params/" %}}create params{{%/link%}} for certain actions. ### Place an Order 1. Create a new action from the bot's details page to respond based on the business logic as discussed in the previous step, and name it as "Place an order". The sample sentences for this action can be defined as follows: * "I want to place an order" * "Need to place order" * "I have an account **amelia.burrows@zylker.com** and I would like to place an order of the product id : 18392188283 to be delivered on 11-Dec-2025" 2. Click {{%bold%}}Next{{%/bold%}} after configuring the sentences. 3. Click {{%bold%}}New Param{{%/bold%}} and select the param type, as instructed below. Click {{%bold%}}String{{%/bold%}} and a {{%bold%}}New Param{{%/bold%}} dialog box will open. <br /> Provide the name for the param as "productid" and add a prompt message by referring to the table below. To learn more about the attributes of each param type in detail, please refer to {{%link href="/en/convokraft/help/actions/define-params/#attributes-of-a-param" %}}this page{{%/link%}}. <br /> We will be creating the following params for this action : <table class="content-table"> <thead> <tr> <th>Param Type</th> <th>Name</th> <th>Prompt message</th> <th>Prompt message for validation failure</th> </tr> </thead> <tbody> <tr> <td>String</td> <td>{{%badge%}}productid{{%/badge%}}</td> <td>Please enter the Product ID</td> <td>The entered ProductID is invalid. Please check and retry.</td> </tr> <tr> <td>Email</td> <td>{{%badge%}}cxemail{{%/badge%}}</td> <td>Please enter your Email Address</td> <td>The entered email address is invalid. Please check and retry.</td> </tr> <tr> <td>Date</td> <td>{{%badge%}}cxdate{{%/badge%}}</td> <td>Please enter the date on which you expect the delivery</td> <td>The entered date is invalid. Please check and retry.</td> </tr> <tr> <td>String</td> <td>{{%badge%}}cxaddr{{%/badge%}}</td> <td>Please enter the address where you want the order to be delivered</td> <td>The entered address is invalid. Please check and retry.</td> </tr> </tbody> </table> In a similar way, create the other three params, "cxemail", "cxdate", and "cxaddr" with the param type and prompt messages as mentioned in the table above. {{%note%}}{{%bold%}}Note :{{%/bold%}} The mode of input for a date param can be selected as Textual or Visual, as per your preferences.{{%/note%}} 4. You can map the params with the corresponding text in the sample sentences, in order to instruct the bot to prompt the inputs from the user consecutively in the conversation. For this, hover over the text in the sample sentence and choose the corresponding param to associate them. <br /> 5. After configuring the sample sentences and params for the action, click {{%bold%}}Save{{%/bold%}}. ### View Order Details 1. Create a new action, and choose to configure a response based on business logic. Name it as "View Order Details". 2. Add the following {{%link href="/en/convokraft/help/actions/define-sample-sentences/" %}}create a ConvoKraft bot{{%/link%}} for the action : * "Where is my order?" * "I want to view my order details of email id amelia.burrows@zylker.com" * "I want to check my order details" 3. Define the params specified below for the action as discussed in the last section. You can associate the params with the sample sentence as shown in the screenshot above and click {{%bold%}}Save{{%/bold%}}. <table class="content-table"> <thead> <tr> <th>Param Type</th> <th>Name</th> <th>Prompt message</th> <th>Prompt message for validation failure</th> </tr> </thead> <tbody> <tr> <td>Email</td> <td>{{%badge%}}cxemail{{%/badge%}}</td> <td>Please provide the email address associated with your order</td> <td>The entered email address is invalid. Please check and retry.</td> </tr> </tbody> </table> <br /> ### Change Delivery Address 1. Similar to the actions created above, we will be configuring the response of this action to be based on a business logic. Enter the name of the action as "Change Delivery Address". For this action, you can define the sample sentences given below : * "I want my order to be delivered at a different address" * "I want to change delivery address for my order id 5804508000000460006 under the email amelia.burrows@zylker.com" 2. Add the params given below for the action: <table class="content-table"> <thead> <tr> <th>Param Type</th> <th>Name</th> <th>Prompt message</th> <th>Prompt message for validation failure</th> </tr> </thead> <tbody> <tr> <td>Email</td> <td>{{%badge%}}cxemail{{%/badge%}}</td> <td>Please provide the email Address associated with your order.</td> <td>The entered email address is invalid. Please check and retry.</td> </tr> <tr> <td>String</td> <td>{{%badge%}}cxorderid{{%/badge%}}</td> <td>Please enter your Order ID.</td> <td>The entered OrderID is invalid. Please check and retry.</td> </tr> <tr> <td>String</td> <td>{{%badge%}}cxaddr{{%/badge%}}</td> <td>Please enter the address where you want the order to be delivered.</td> <td>The entered address is invalid. Please check and retry.</td> </tr> </tbody> </table> You can associate the params as shown in the screenshot below and click {{%bold%}}Save{{%/bold%}}. <br /> ### Re-schedule order date 1. Enter the name of the action as "Reschedule order date". You can define the below sample sentences for the action: * "Reschedule my order to later date" * "Postpone the delivery date of my order" * "I want to change my orders delivery date as 19/07/2023 for my order id 5804508000000460006 of my email amelia.burrows@zylker.com" 2. Add the params below for the action : <table class="content-table"> <thead> <tr> <th>Param Type</th> <th>Name</th> <th>Prompt message</th> <th>Prompt message for validation failure</th> </tr> </thead> <tbody> <tr> <td>Email</td> <td>{{%badge%}}cxemail{{%/badge%}}</td> <td>Please provide the email ID associated with your order.</td> <td>The entered email ID is invalid. Please check and retry.</td> </tr> <tr> <td>String</td> <td>{{%badge%}}cxorderid{{%/badge%}}</td> <td>Please enter your Order ID.</td> <td>The entered OrderID is invalid. Please check and retry.</td> </tr> <tr> <td>Date</td> <td>{{%badge%}}cxdate{{%/badge%}}</td> <td>Mention the date you would like to reschedule your order</td> <td>The entered date is invalid. Please check and retry.</td> </tr> </tbody> </table> <br /> The actions are now configured for the bot. -------------------------------------------------------------------------------- title: "Create custom modules in CRM" description: "Configure a conversational sales assitant bot for an ecommerce website using Catalyst ConvoKraft, Serverless Integration functions, and Zoho CRM that will interact with the website users, and manage their orders." last_updated: "2026-03-18T07:41:08.723Z" source: "https://docs.catalyst.zoho.com/en/tutorials/ecommerce-bot/nodejs/create-custom-modules-in-crm/" service: "All Services" related: - CRM Custom Modules (https://help.zoho.com/portal/en/kb/crm/customize-crm-account/customizing-modules/articles/customize-modules#Custom_Modules_or_User-Generated_Modules) -------------------------------------------------------------------------------- # Create Custom modules in CRM Modules in {{%link href="https://help.zoho.com/portal/en/kb/crm/getting-started/articles/get-started-introduction-zoho-crm#What_is_CRM" %}}Zoho CRM{{%/link%}}, let you categorize and track various aspects of your business. We will be creating two custom modules namely EcomProducts and Orders for storing the product inventory and the orders placed respectively. You can learn more about custom modules from the {{%link href="https://help.zoho.com/portal/en/kb/crm/customize-crm-account/customizing-modules/articles/customize-modules#Custom_Modules_or_User-Generated_Modules" %}}CRM documentation{{%/link%}}. To create a custom module in CRM, follow these steps: 1. {{%link href="https://www.zoho.com/crm/login.html" %}}Login{{%/link%}} to your Zoho CRM account. 2. Click {{%bold%}}Setup{{%/bold%}} in the top right corner of the dashboard as shown in the screenshot below, and under the {{%bold%}}Customization{{%/bold%}} section, click {{%bold%}}Modules and Fields{{%/bold%}}. <br /> 3. Click {{%bold%}}New Module{{%/bold%}}. <br /> #### EcomProducts This module is used to store the details of various products available in the ecommerce online store. Please make sure to add the fields given below for the {{%badge%}}EcomProducts{{%/badge%}} custom module. <table class="content-table"> <thead> <tr> <th>Field Name</th> <th>Type</th> </tr> </thead> <tbody> <tr> <td>{{%badge%}}EcomProductName{{%/badge%}}</td> <td>Single Line</td> </tr> <tr> <td>{{%badge%}}Product_image{{%/badge%}}</td> <td>URL</td> </tr> <tr> <td>{{%badge%}}Price{{%/badge%}}</td> <td>Number</td> </tr> <tr> <td>{{%badge%}}Inventory Count{{%/badge%}}</td> <td>Number</td> </tr> <tr> <td>{{%badge%}}EcomProduct Owner{{%/badge%}}</td> <td>User</td> </tr> </tbody> </table> You can simply drag and drop the field type to add a new field. <br /> After you add the fields, click {{%bold%}}Save{{%/bold%}}. Provide the module name as "EcomProducts" and select the module permission as {{%bold%}}Administrator{{%/bold%}} as shown in the screenshot below. <br /> Now, you can create any number of products by adding them as records in the module. Navigate back to the modules page, and click on {{%bold%}}Ecomproducts{{%/bold%}} from the menu as shown in the screenshot below. <br /> Click on **Create EcomProduct**. <br /> Provide the values for all the fields and click Save. <br /> #### Orders This module is created to store the order details of your ecommerce online store. Create this new module similarly mentioned before and name it "Orders". You can then configure the fields listed below for this custom module : <table class="content-table"> <thead> <tr> <th>Field Name</th> <th>Type</th> </tr> </thead> <tbody> <tr> <td>{{%badge%}}Order Name{{%/badge%}}</td> <td>Single Line</td> </tr> <tr> <td>{{%badge%}}Email{{%/badge%}}</td> <td>Email</td> </tr> <tr> <td>{{%badge%}}Contact_No{{%/badge%}}</td> <td>Phone</td> </tr> <tr> <td>{{%badge%}}Product_Name{{%/badge%}}</td> <td>Single Line</td> </tr> <tr> <td>{{%badge%}}OrderID{{%/badge%}}</td> <td>Single Line</td> </tr> <tr> <td>{{%badge%}}Order_Status{{%/badge%}}</td> <td>Single Line</td> </tr> <tr> <td>{{%badge%}}Order_Owner{{%/badge%}}</td> <td>User</td> </tr> </tr> <tr> <td>{{%badge%}}Modified By{{%/badge%}}</td> <td>Single Line</td> </tr> <tr> <td>{{%badge%}}Price{{%/badge%}}</td> <td>Number</td> </tr> <tr> <td>{{%badge%}}Delivery_Address{{%/badge%}}</td> <td>Multi Line</td> </tr> <tr> <td>{{%badge%}}product_image_url{{%/badge%}}</td> <td>URL</td> </tr> <tr> <td>{{%badge%}}Expected_Delivery_Date{{%/badge%}}</td> <td>Single Line</td> </tr> </tbody> </table> Whenever the user places an order, by conversing with the bot an entry will be automatically made in this module, i.e., the record will be created. <br /> The record details will appear as follows: <br /> {{%note%}}{{%bold%}}Note :{{%/bold%}} Please make sure you use the exact same names for the fields, as we have used them in our bot's business logic.{{%/note%}} -------------------------------------------------------------------------------- title: "Initialize the project" description: "Configure a conversational sales assitant bot for an ecommerce website using Catalyst ConvoKraft, Serverless Integration functions, and Zoho CRM that will interact with the website users, and manage their orders." last_updated: "2026-03-18T07:41:08.724Z" source: "https://docs.catalyst.zoho.com/en/tutorials/ecommerce-bot/nodejs/initialize-project/" service: "All Services" related: - Catalyst Integration Functions (/en/convokraft/help/actions/bot-logic/catalyst-integration-functions) - Project Directory Structure (/en/cli/v1/project-directory-structure/introduction/) -------------------------------------------------------------------------------- # Initialize the Project from the CLI After configuring the actions for a bot, we can proceed to configure the business logic of those actions. As mentioned earlier, we will be using {{%link href="/en/convokraft/help/actions/bot-logic/catalyst-integration-functions"%}}Catalyst Integration functions{{%/link%}} to code the bot logic of the ecommerce bot. In order to code the Catalyst functions, we will need to first initialize the project from the {{%link href="/en/cli/v1/login/login-from-cli/" %}}Catalyst CLI{{%/link%}}. The first step is to {{%link href="/en/cli/v1/login/login-from-cli/" %}}login to the CLI{{%/link%}} and {{%link href="/en/cli/v1/initialize-resources/introduction" %}}initialize the project{{%/link%}} in an empty local directory. This will be the home directory of your project and all of the project files will be saved in it. You can learn more about the project directory structure for all programming stacks supported by Catalyst from {{%link href="/en/cli/v1/project-directory-structure/introduction/"%}}this page{{%/link%}}. You can learn about initializing a Catalyst project in detail from the {{%link href="/en/cli/v1/initialize-resources/introduction" %}}CLI help documentation{{%/link%}}. {{%note%}}{{%bold%}}Note:{{%/bold%}} Ensure that you enter the function's package name exactly as instructed, because the application's code contains the same name.{{%/note%}} Please follow the steps listed below to initialize the project and create the required functions and client components: 1. Create a folder for the project on your local machine and navigate to it from the CLI terminal. 2. To initialize the project, please execute the following command: {{%cli%}}catalyst init{{%/cli%}} 3. The CLI will now ask you to select the {{%link href="/en/getting-started/catalyst-organizations/#the-default-organization" %}}default Catalyst organization{{%/link%}}. Select the organization in which you created the project in the first step of this tutorial and press **Enter**. <br/> 4. You can associate the current project directory with the Catalyst project you created in this organization. Select **Ecommerce** and press **Enter**. <br/> 5. Select the components that you need to set up for your Catalyst application. Navigate through the options using the arrow keys and select them by pressing space bar. Select **Functions** and **Client** and press **Enter** to confirm your choices. <br/> 6. Select the type of function you would like to develop. For this tutorial, choose **Functions** and **Client**. In the Functions setup step, select **Integration**. <br/> 7. In the next step, select the service as **Convokraft**. <br/> 8. Select the preferred stack to develop the Catalyst Integration function and press **Enter**. For this tutorial, we will be coding the functions in **Node.js 16**. <br/> 9. Provide the package name as "ecommerce_function" for your Node function when prompted and press **Enter**. You must also define the entry point as {{%badge%}}index.js{{%/badge%}} and author details in this step. {{%note%}}{{%bold%}}Note:{{%/bold%}} Ensure that you enter the function's package name exactly as instructed, because the application's code contains the same name.{{%/note%}} <br/> The function's directory will now contain the initialized {{%badge%}}ecommerce_function{{%/badge%}}, its handler function files and other configuration files. You can also learn about the project directory structure in detail, from this {{%link href="/en/cli/v1/project-directory-structure/functions-directory/#node-modules-and-node-js-function-dependencies" %}}page{{%/link%}}. 10. The CLI will initiate the client setup next. Select **Basic web app** as your client type. <br/> 11. Enter {{%badge%}}ecommerceclient{{%/badge%}} as the name of the client package and then press **Enter**. You can enter any name you need. <br/> The client directory will be created in the standard structure and will look like this: <br/> 12. This Catalyst Node.js function requires **express** framework to perform routing operations. To install the express modules in the function's directory, navigate to {{%badge%}}functions/ecommerce_function{{%/badge%}} and execute the following command in the terminal: {{%cli%}}npm install express -save{{%/cli%}} <br/> The function's directory will look like this: <br/> Catalyst initialization is now complete. The project directory will contain the function and the client, as well as other project dependency files. -------------------------------------------------------------------------------- title: "Configure the Integration function" description: "Configure a conversational sales assitant bot for an ecommerce website using Catalyst ConvoKraft, Serverless Integration functions, and Zoho CRM that will interact with the website users, and manage their orders." last_updated: "2026-03-18T07:41:08.724Z" source: "https://docs.catalyst.zoho.com/en/tutorials/ecommerce-bot/nodejs/configure-function/" service: "All Services" related: - Project Directory Structure (/en/cli/v1/project-directory-structure/introduction/) -------------------------------------------------------------------------------- # Configure the Integration Function Next, we will begin coding the execution logic of the ecommerce bot by configuring the Integration function that we initialized earlier. The function’s directory, {{%badge%}}functions/ecommerce_function{{%/badge%}} contains: - The {{%badge%}}index.js{{%/badge%}} main function file - The ConvoKraft handler function files - The {{%badge%}}catalyst-config.json{{%/badge%}} configuration file - Node modules - {{%link href="https://docs.npmjs.com/files/package.json"%}}{{%badge%}}package.json{{%/badge%}}{{%/link%}} and {{%link href="https://docs.npmjs.com/configuring-npm/package-lock-json.html"%}}{{%badge%}}package-lock.json{{%/badge%}}{{%/link%}} dependency files We will be adding code in the handler functions: {{%badge%}}execute.js{{%/badge%}}, {{%badge%}}fallback.js{{%/badge%}}, {{%badge%}}failure.js{{%/badge%}}, {{%badge%}}welcome.js{{%/badge%}}, as well the main {{%badge%}}index.js{{%/badge%}} file. Copy and paste the code given below carefully in the respective files using any IDE of your choice and save them. {{% panel_with_adjustment header="execute.js" footer="button" class="language-javascript line-numbers" scroll="set-scroll" %}}import logger from "./logger.js"; import fetch from "node-fetch"; import catalyst from "zcatalyst-sdk-node"; // Function to make GET requests async function get(url, headers) { const response = await fetch(url, { method: 'GET', headers: headers }); return await response.json(); } function getRandomNumber(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } // Function to make POST requests async function post(url, headers, body) { const response = await fetch(url, { method: 'POST', headers: headers, body: JSON.stringify(body) }); return await response.json(); } // Function to make PUT requests async function put(url, headers, body) { const response = await fetch(url, { method: 'PUT', headers: headers, body: JSON.stringify(body) }); return await response.json(); } async function getCRMToken(request) { const catalystApp = catalyst.initialize(request); var connector = catalystApp.connection({ CRMTOKEN: { client_id: &#96;${process.env.client_id}&#96;, client_secret: &#96;${process.env.client_secret}&#96;, auth_url: &#96;${process.env.auth_url}&#96;, refresh_url: &#96;${process.env.refresh_url}&#96;, refresh_token: &#96;${process.env.refresh_token}&#96; } }).getConnector('CRMTOKEN'); let accessTokenResponse=await connector.getAccessToken().then((accessToken) => { //console.log("Inside accesstoken"+accessToken); return accessToken; }); return accessTokenResponse; } // Invoke URL function async function invokeURL(options) { if (options.type === 'GET') { const response = await get(options.url, options.headers); return response; } else if (options.type === 'POST') { const response = await post(options.url, options.headers, options.body); return response; } else if (options.type === 'PUT') { const response = await put(options.url, options.headers, options.body); return response; } else { throw new Error(&#96;Unsupported HTTP method: ${options.type}&#96;); } } // Handle the execute functionality export default async function handleExecute(request) { logger.info('Handling execute request with params : '+JSON.stringify(request)); logger.info('Action NameSpace : '+request.action.namespace); logger.info('Params : '+JSON.stringify(request.params)); logger.info('Broadcast : '+JSON.stringify(request.broadcast)); const result = {}; const cardlist = []; switch(request.action.namespace) { case "listofitems_2": logger.info('Inside NameSpace '+request.action.namespace); const executeViewItemsLogic = async () => { //let zohocrmapiurl=process.env.crmapiurl; console.log("ENV VARIABLE "+JSON.stringify(process.env)); //console.log("Client ID"+`${process.env.client_id}`); const token=await getCRMToken(request); //console.log("ACCESSTOKEN RESP : "+token); const accessToken = 'Zoho-Oauthtoken ' + token; logger.info('Access Token : '+accessToken); const header_data = new Map(); header_data.set('Content-Type', 'application/json'); header_data.set('Authorization', accessToken); const CRMresponse = await invokeURL({ url: 'https://'+process.env.crmapiurl+'/crm/v2/EcomProducts?fields=Name,Product_image_url,Price,Inventory_Count,Product_image', type: 'GET', headers: header_data }); logger.info("Response for list of items "+ JSON.stringify(CRMresponse)); const productNote = { "type": "note", "content": "List of items available are listed as follows" }; cardlist.push(productNote); for (const record of CRMresponse.data) { logger.info('RECPORD INFO : '+JSON.stringify(record)); const name = record.Name; const price = record.Price; const product_id = record.id; const image = record.Product_image; const inventory = record.Inventory_Count; const listItem = { "type": "list", "format": "bullet", "elements": [ { "label": `Name : ${name}` }, { "label": `Total Price : $ ${price}` }, { "label": `Product ID : ${product_id}` }, { "label": `Stock : ${inventory}` } ] }; const productPic = { "type": "image", "content": image }; cardlist.push(productPic); cardlist.push(listItem); logger.info('Card List : : : :'+JSON.stringify(cardlist)); } result.card= cardlist; result.message= "List of Objects in response"; logger.info('Result Obj inside the : : : ' + result); logger.info('Result OF MAP : : : :'+JSON.stringify(result)); }; await executeViewItemsLogic(); logger.info('Result Obj before return : : : ' + JSON.stringify(result)); return result; break; case "vieworderdetails_3": logger.info('Inside NameSpace ' + request.action.namespace); const executeViewOrderLogic = async () => { const token=await getCRMToken(request); var cxemail=request.params.cxemail; const accessToken = 'Zoho-Oauthtoken ' + token; logger.info('Access Token: ' + accessToken); const header_data = new Map(); header_data.set('Content-Type', 'application/json'); header_data.set('Authorization', accessToken); let resp={} try{ resp = await invokeURL({ url: 'https://'+process.env.crmapiurl+'/crm/v4/Orders/search?criteria=((Email:equals:' + cxemail + '))', type: 'GET', headers: header_data }); }catch(er) { logger.info('ERROR WHILE CRM DATA SEARCH ' + er); } logger.info('Response: ' + JSON.stringify(resp)); let items_count = 0; for (const order of resp.data) { items_count++; logger.info('Inside Resp Iterator - Item count : '+items_count+' Order details : '+JSON.stringify(order)); const order_id = order.id; const CRMresponse = await invokeURL({ url: 'https://'+process.env.crmapiurl+'/crm/v3/Orders/' + order_id, type: 'GET', headers: header_data }); logger.info("CRMRESPONSE : : : :"+JSON.stringify(CRMresponse.data[0].product_image_url)); const orderid = order.OrderID; const name = order.Name; const contact = order.Contact_No; const email = order.Email; const product_name = order.Product_Name; const price = order.Price; const delivery_date = order.Expected_Delivery_Date; const delivery_address = order.Delivery_Address; const order_status = order.Order_Status; const listItem = { "type": "list", "format": "bullet", "elements": [ { "label": "Name: " + name }, { "label": "Contact No: " + contact }, { "label": "Email ID: " + email }, { "label": "Product Name: " + product_name }, { "label": "Total Price: $" + price }, { "label": "Expected Delivery Date: " + delivery_date }, { "label": "Delivery Address: " + delivery_address }, { "label": "Order Status: " + order_status } ] }; const productNote = { "type": "note", "content": items_count + ") Your order details for order id : " + orderid + " are listed as follows: " }; const productPic = { "type": "image", "content": CRMresponse.data[0].product_image_url }; cardlist.push(productNote); cardlist.push(productPic); cardlist.push(listItem); logger.info("CARD LIST : : : "+JSON.stringify(cardlist)); } result.card = cardlist; // defining broadcast result.broadcast = { "cxemail": cxemail }; result.message = "The Shoppers Stores. You don't have an order."; logger.info("Result JSON : : : "+JSON.stringify(result)); }; await executeViewOrderLogic(); //logger.info('Result Obj before return: ' + JSON.stringify(result)); return result; break; case "placeanorder_4": logger.info('Inside NameSpace ' + request.action.namespace); const executePlaceOrderLogic = async () => { const placeorder = {}; const token=await getCRMToken(request); const accessToken = 'Zoho-Oauthtoken ' + token; logger.info('Access Token: ' + accessToken); const header_data = new Map(); header_data.set('Content-Type', 'application/json'); header_data.set('Authorization', accessToken); try { const CRMresponse = await invokeURL({ url: 'https://'+process.env.crmapiurl+'/crm/v2/EcomProducts/' + request.params.productid, type: 'GET', headers: header_data }); logger.info('CRM Response: ' + JSON.stringify(CRMresponse)); if (CRMresponse.data == null && CRMresponse.status != 'error') { const stock_count = 0; logger.info('Empty response. Stock count reset.'); placeorder.put('Stock', 'Empty'); } else { const recordid = CRMresponse.data[0].id; let stock_count = CRMresponse.data[0].Inventory_Count; const imageurl = CRMresponse.data[0].Product_image; const productname = CRMresponse.data[0].Name; const price = CRMresponse.data[0].Price; logger.info(recordid+" "+stock_count+" "+imageurl+" "+productname+" "+price); if (stock_count > 0) { stock_count = stock_count - 1; const reduceStock = { id: recordid, Inventory_Count: stock_count }; const updatedata = [reduceStock]; const updatedatamap = { data: updatedata }; const updateResp = await invokeURL({ url: 'https://'+process.env.crmapiurl+'/crm/v2/EcomProducts', type: 'PUT', body: updatedatamap, headers: header_data }); logger.info('Update Response: ' + JSON.stringify(updateResp)); placeorder.Name = productname + ' ' + request.params.cxdate; // Assign the value using dot notation placeorder.Product_Name = productname; // Assign the value using dot notation placeorder.Email = request.params.cxemail; // Assign the value using dot notation placeorder.Delivery_Address = request.params.cxaddr; // Assign the value using dot notation placeorder.Expected_Delivery_Date = new Date(request.params.cxdate).toLocaleDateString(); // Assign the value using dot notation placeorder.product_image_url = imageurl; // Assign the value using dot notation placeorder.Price = price; // Assign the value using dot notation const orderID = request.params.productid + '_' + getRandomNumber(1111111, 9999999); //placeorder.put('OrderID', orderID); placeorder.OrderID = orderID; placeorder.Order_Status = 'Reviewing the Order'; // Assign the value using dot notation const insertdatamap = { data: [placeorder] }; logger.info("INSERT MAP : : :"+JSON.stringify(insertdatamap)); const insertResp = await invokeURL({ url: 'https://'+process.env.crmapiurl+'/crm/v2/Orders', type: 'POST', body: insertdatamap, headers: header_data }); logger.info('Insert Response: ' + JSON.stringify(insertResp)); result.message = 'Your order for the product - ' + CRMresponse.data[0].Name + ' is placed successfully. It will be tried to be delivered on ' + request.params.cxdate + ' to ' + request.params.cxaddr + '. Our Sales team will reach out to you via email to discuss COD or prepayment before delivery.'; } else { result.message = 'The item is out of stock. Please retry after some days as we restock.'; } } } catch (e) { logger.info(e.lineNo); logger.info(e.message); logger.info(e); result.message = 'There was some issue during the order. Please contact the support team. They shall assist in placing this order for you.'; } result.broadcast = { cxemail: request.params.cxemail }; }; await executePlaceOrderLogic(); return result; break; case "changedeliveryaddress": // New case for "changedeliveryaddress" logger.info('Inside NameSpace ' + request.action.namespace); const executeChangeDeliveryAddressLogic = async () => { const token=await getCRMToken(request); const cxorderid = request.params.cxorderid; const cxaddr = request.params.cxaddr; const cxemailid = request.params.cxemail; const accessToken = 'Zoho-Oauthtoken ' + token; logger.info('Access Token: ' + accessToken); const header_data = new Map(); header_data.set('Content-Type', 'application/json'); header_data.set('Authorization', accessToken); let searchOrderResp={}; try{ searchOrderResp = await invokeURL({ url: 'https://'+process.env.crmapiurl+'/crm/v4/Orders/search?criteria=((OrderID:equals:' + cxorderid + '))', type: 'GET', headers: header_data }); }catch(e) { logger.info("ERROR DURING SEARCH ORDER : : "+e); searchOrderResp={}; } logger.info("Result of search Order: : : "+JSON.stringify(searchOrderResp)); if(searchOrderResp.data!=undefined) { const recordId = searchOrderResp.data[0].id; //logger.info("Result of search Order: : : "+JSON.stringify(searchOrderResp.data[0])); const recordEmail=searchOrderResp.data[0].Email; const recordorderId=searchOrderResp.data[0].OrderID; if(cxemailid == recordEmail && cxorderid == recordorderId) { const updateData = [ { id: recordId, Delivery_Address: cxaddr } ]; const updateDataMap = { data: updateData }; const updateResp = await invokeURL({ url: 'https://'+process.env.crmapiurl+'/crm/v2/Orders', type: 'PUT', body: updateDataMap, headers: header_data }); logger.info('Update Response: ' + JSON.stringify(updateResp)); result.message = 'Delivery address updated successfully.'; } else{ result.message='Given Order ID or Email is not proper. Please check and retry'; } } else { result.message='Given Order ID or Email is not proper. Please check and retry'; } }; await executeChangeDeliveryAddressLogic(); return result; break; case "rescheduleorderdate": logger.info('Inside NameSpace ' + request.action.namespace); const executeChangeDeliveryDateLogic = async () => { const token=await getCRMToken(request); const accessToken = 'Zoho-Oauthtoken ' + token; logger.info('Access Token: ' + accessToken); const header_data = new Map(); header_data.set('Content-Type', 'application/json'); header_data.set('Authorization', accessToken); const cxemailid = request.params.cxemail; const cxorderid = request.params.cxorderid; let searchOrderResp={}; try{ searchOrderResp = await invokeURL({ url: 'https://'+process.env.crmapiurl+'/crm/v2/Orders/search?criteria=((OrderID:equals:' + request.params.cxorderid + '))', type: 'GET', headers: header_data }); }catch(e) { searchOrderResp={}; } if(searchOrderResp.data!=undefined){ logger.info("Result of search Order: : : "+JSON.stringify(searchOrderResp.data[0])); const recordId = searchOrderResp.data[0].id; const recordEmail=searchOrderResp.data[0].Email; const recordorderId=searchOrderResp.data[0].OrderID; if(cxemailid == recordEmail && cxorderid == recordorderId) { const datemap = { id: recordId, Expected_Delivery_Date: new Date(request.params.cxdate).toLocaleDateString() }; const updatedata = [datemap]; const updatedatamap = { data: updatedata }; logger.info("update Map : : : "+JSON.stringify(updatedatamap)); const updateResp = await invokeURL({ url: 'https://'+process.env.crmapiurl+'/crm/v2/Orders', type: 'PUT', body: updatedatamap, headers: header_data }); logger.info("updateResponse : : : "+JSON.stringify(updateResp)); result.broadcast = { cxemail: request.params.cxemail }; result.message = 'Your order has been rescheduled successfully.'; }else{ result.message='Given Order ID or Email is not proper. Please check and retry'; } } else{ result.message='Given Order ID or Email is not proper. Please check and retry'; } }; await executeChangeDeliveryDateLogic(); return result; break; default : result.message='Given request is invalid. Please check and retry'; return result; break; } //return response; } {{% /panel_with_adjustment %}} {{% panel_with_adjustment header="welcome.js" footer="button" class="language-javascript line-numbers" scroll="set-scroll" %}}import logger from "./logger.js"; // Handle the welcome functionality export default function handleWelcome() { logger.info('Handling welcome request'); return { "welcome_response": { "message": "Welcome to your Bot. Please ask your queries" } }; } {{% /panel_with_adjustment %}} {{% panel_with_adjustment header="failure.js" footer="button" class="language-javascript line-numbers" scroll="set-scroll" %}}import logger from "./logger.js"; // Handle the failure functionality export default function handleFailure() { logger.info('Handling failure request'); const result = { "message": "Something went wrong while checking your query. Please try again later." }; return JSON.stringify(result); } {{% /panel_with_adjustment %}} {{% panel_with_adjustment header="fallback.js" footer="button" class="language-javascript line-numbers" scroll="set-scroll" %}}import logger from "./logger.js"; // Handle the fallback functionality export default function handleFallback() { logger.info('Handling fallback request'); const result = { "message": "Sorry couldn't get that." }; return JSON.stringify(result); } {{% /panel_with_adjustment %}} {{% panel_with_adjustment header="index.js" footer="button" class="language-javascript line-numbers" scroll="set-scroll" %}}import logger from './logger.js'; import IntegResponse from './integ-response.js'; import handleWelcome from './welcome.js'; import handleFallback from './fallback.js'; import handleExecute from './execute.js'; import handleFailure from './failure.js'; export default async (request, response) => { let jsonResponse = {}; try { logger.info('REQUEST FLOW FOR : : : ' + request.todo); switch (request.todo) { case "welcome": jsonResponse = handleWelcome(); break; case "execute": jsonResponse = await handleExecute(request); break; case "fallback": jsonResponse = handleFallback(); break; case "failure": jsonResponse = handleFailure(); break; default: jsonResponse = JSON.stringify({ "message": "Error Trying to parse your details" }); } } catch (err) { logger.error('Error while executing handler: ' + err); logger.error('REQUEST OBJECT: ' + JSON.stringify(request)); jsonResponse = JSON.stringify({ "message": "Error Trying to parse your details" }); } //The Response has to be encapuslated into an IntegResponse Object response.end(new IntegResponse(jsonResponse)); }; {{% /panel_with_adjustment %}} {{%note%}}{{%bold%}}Note:{{%/bold%}} Please go through all the codes given in this section to ensure you fully understand it.{{%/note%}} Let's quickly go through each of the function files and the logic coded in them: 1. **{{%badge%}}execute.js{{%/badge%}}**: This file contains the main execution logic of all the actions of our ecommerce bot. All these actions authenticate your Zoho CRM account using the configured environmental variables and fetches the required details or performs the below listed actions, as required. We will be configuring the environmental variables for the {{%badge%}}ecommerce_function{{%/badge%}} Catalyst function directly from the Catalyst console, after deploying the function to the console in this step. * **{{%badge%}}listofitems_2{{%/badge%}}** : This action initiates an API request and triggers a GET method on the custom CRM module {{%badge%}}EcomProducts{{%/badge%}}, retrieving the product name, product ID, product image URL, price, and stock count. * **{{%badge%}}placeanorder_4{{%/badge%}}** : This action accepts the product ID as an input from the user. It then checks for the stock availability of the particular product in the EcomProducts CRM module. If the stock is available, the bot proceeds to ask the user's email address, the expected date of delivery and the delivery address. Once these details are entered, the bot places an order by initiating an API request and triggering a POST method on the custom CRM module {{%badge%}}Orders{{%/badge%}}.The user will be intimated on the successful placement of the order via the chatbot. If the product stock is not available, then the same will be informed to the user. * **{{%badge%}}vieworderdetails_3{{%/badge%}}** :This action triggers the {{%link href="https://www.zoho.com/crm/developer/docs/api/v4/search-records.html" %}}Zoho CRM Search API{{%/link%}} to perform a search operation on the custom module {{%badge%}}Orders{{%/badge%}}. The customer name, contact number, email id, product name, price of the product, product image URL, expected delivery date, delivery address and status of the order details are fetched as the response. * **{{%badge%}}changedeliveryaddress{{%/badge%}}** : This action accepts the email id associated with the order, the order ID and the address to which the order has to be delivered, as inputs. The {{%link href="https://www.zoho.com/crm/developer/docs/api/v4/search-records.html" %}}Zoho CRM Search API{{%/link%}} is triggered on our custom module {{%badge%}}Orders{{%/badge%}}. The given email id and order id are validated and the new address is updated in the order by executing a PUT method on the custom module {{%badge%}}Orders{{%/badge%}}. * **{{%badge%}}rescheduleorderdate{{%/badge%}}** : This action accepts the email id associated with the order, and the order ID as inputs. The {{%link href="https://www.zoho.com/crm/developer/docs/api/v4/search-records.html" %}}Zoho CRM Search API{{%/link%}} is triggered on our custom module {{%badge%}}Orders{{%/badge%}}, the search operation is done for the given orderID. The email id and order id are validated and the next possible date is updated as the delivery date in the order again by executing a PUT method on the custom module {{%badge%}}Orders{{%/badge%}}. The above mentioned action names are namespaces of the action created in the console. Please make sure to update the namespaces generated for your actions in the code in line number 82, 145, 238, 337, 407 for the switch cases {{%badge%}}listofitems_2{{%/badge%}}, {{%badge%}}vieworderdetails{{%/badge%}}, {{%badge%}}placeanorder{{%/badge%}}, {{%badge%}}changedeliveryaddress{{%/badge%}}, {{%badge%}}rescheduleordertolaterdate{{%/badge%}} respectively. You can get the namespaces of the action from the console as shown in the screenshot below. <br/> 2. **{{%badge%}}welcome.js{{%/badge%}}**: In this file, we have configured the message to be displayed to greet the user when initiating a fresh conversation with the user. 3. **{{%badge%}}Fallback.js{{%/badge%}}**: In this file, we have configured the message to be displayed to the user when the bot fails to comprehend user's message. In this case, this response will be shown in the conversation until the user enters the valid response and the bot understands it. 4. **{{%badge%}}failure.js{{%/badge%}}**: In this file, we have configured the message to be displayed to the user when an exception occurs while executing the business logic. 5. **{{%badge%}}index.js{{%/badge%}}**: his is the entry point of the function and here we will map the corresponding handler files such as execute, welcome, fallback or failure based on the {{%link href="/en/convokraft/help/actions/bot-logic/deluge-functions/context-handler-function/#todo" %}}{{%badge%}}todo{{%/badge%}}{{%/link%}} prompt during the bot conversation. -------------------------------------------------------------------------------- title: "Register the Client" description: "Configure a conversational sales assitant bot for an ecommerce website using Catalyst ConvoKraft, Serverless Integration functions, and Zoho CRM that will interact with the website users, and manage their orders." last_updated: "2026-03-18T07:41:08.724Z" source: "https://docs.catalyst.zoho.com/en/tutorials/ecommerce-bot/nodejs/register-client/" service: "All Services" related: - Generate API Tokens (/en/api/oauth2/generate-access-and-refresh-token/#GenerateAccessandRefreshToken) -------------------------------------------------------------------------------- # Register the Client We will need to generate access tokens in order to authenticate and CRM resources effectively. Please make sure to follow the steps listed below. 1. Login to {{%link href="https://api-console.zoho.com/" %}}Zoho's API Console{{%/link%}}. Click **Self Client**. <br /> 2. Add the following scope, then set the scope duration and provide a scope descripton. Click **Create**. You can learn more about scopes from {{%link href="https://www.zoho.com/crm/developer/docs/api/v6/scopes.html" %}}this section{{%/link%}}. <br /> 3. Select **CRM** as the portal and choose your project on the right pane. Click **Create**. <br /> 4. The {{%link href="/en/api/oauth2/generate-grant-token/#GenerateGrantToken" %}}Grant token{{%/link%}} will be generated for the specified scopes. You can fetch the {{%link href="/en/api/oauth2/register-new-client/" %}}Client ID{{%/link%}} and {{%link href="/en/api/oauth2/register-new-client/" %}}Client Secret{{%/link%}} credentials from Client Secret tab. You will need to generate the access and refresh tokens by following the steps mentioned in {{%link href="/en/api/oauth2/generate-access-and-refresh-token/#GenerateAccessandRefreshToken" %}}this page{{%/link%}}. <br /> {{%note%}}{{%bold%}}Note:{{%/bold%}} Please make sure you save these credentials. We will be configuring these values as environmental variables to our function in {{%link href="/en/tutorials/ecommerce-bot/nodejs/deploy-to-console" %}}this step.{{%/link%}}{{%/note%}} -------------------------------------------------------------------------------- title: "Configure the client" last_updated: "2026-03-18T07:41:08.724Z" source: "https://docs.catalyst.zoho.com/en/tutorials/ecommerce-bot/nodejs/configure-client/" service: "All Services" related: - ConvoKraft JS SDK (/en/convokraft/sdk/js/overview/) -------------------------------------------------------------------------------- # Configure the Client Lets now configure the client component. The client directory you initialized will contain: * The {{%badge%}}index.html{{%/badge%}} file for the HTML code of the frontend application * The {{%badge%}}main.css{{%/badge%}} for the CSS code * The {{%badge%}}main.js{{%/badge%}} file for the JavaScript code * The {{%badge%}}client-package.json{{%/badge%}} configuration file You can download this zip, copy all the files in it and replace them with the default client files created in your client directory. This {{%link href="https://github.com/catalystbyzoho/tutorial-convokraft" %}}git repository{{%/link%}} contains additional files besides the default ones. We have the entire client code, and the required images and icon files all packed in this, you can simply download it as a zip file. {{%note%}}{{%bold%}}Note :{{%/bold%}} Please go through the code in each file to make sure you fully understand it.{{%/note%}} Catalyst enables you to host the client part of the web application using the {{%link href="/en/cloud-scale/help/web-client-hosting/introduction/" %}}Catalyst Web Client Hosting{{%/link%}} component. We will be deploying the client to the console along with the functions {{%link href="/en/tutorials/ecommerce-bot/nodejs/configure-function/" %}}created earlier{{%/link%}}, in {{%link href="/en/tutorials/ecommerce-bot/nodejs/deploy-to-console/" %}}this step{{%/link%}} of the tutorial. ### Embed the bot in the website In order to embed the ConvoKraft bot in your application, please make sure you add the javascript code snippet given below in the {{%badge%}}contact.html{{%/badge%}} file in your client directory and save it. We also offer a {{%link href="/en/convokraft/sdk/js/overview/" %}}ConvoKraft Javascript SDK{{%/link%}} package which contains pre-defined methods that can be quickly incorporated in your client application to customize the appearance of your ConvoKraft bot. {{%code class="language-xml" scroll="set-scroll" %}}&lt;script src="https://console.catalyst.zoho.com/convokraft/assets/js/convokraft-chat-sdk.js"&gt; &lt;/script&gt; &lt;style&gt; div.anchor_zia_toBottom { width: 330px; height: 450px; position: fixed; bottom: 0; right: 0; } &lt;/style&gt; &lt;div class="anchor_zia_toBottom"&gt; &lt;convokraft-chat-bot bot-name="ecommercebot_2" project-id="10644000000029001" org-id="74779991"&gt; &lt;/convokraft-chat-bot&gt; &lt;/div&gt; {{%/code%}} {{%note%}}{{%bold%}}Note :{{%/bold%}} Please make sure you replace the correct values for the bot name, project ID, and org ID attributes in the above code. Open the {{%badge%}}EcommerceBot{{%/badge%}} in the console and in the Bots Details page, the namespace of the bot is the value of this {{%badge%}}bot-name attribute{{%/badge%}}.{{%/note%}} Take the URL of this page. It should appear as follows: {{%link href="https://console.catalyst.zoho.com/baas/74779991/project/10644000000029001/Development#/convokraft/bots/50803000000018005" break="true"%}}https://console<span></span>.catalyst.zoho.com/baas/74779991/project/10644000000029001/Development#/convokraft/bots/50803000000018005{{%/link%}} Here "74779991" is the {{%badge%}}orgID{{%/badge%}} and "10644000000029001" is the {{%badge%}}projectID{{%/badge%}}. -------------------------------------------------------------------------------- title: "Deploy to console" description: "Configure a conversational sales assitant bot for an ecommerce website using Catalyst ConvoKraft, Serverless Integration functions, and Zoho CRM that will interact with the website users, and manage their orders." last_updated: "2026-03-18T07:41:08.724Z" source: "https://docs.catalyst.zoho.com/en/tutorials/ecommerce-bot/nodejs/deploy-to-console/" service: "All Services" related: - Deploy Catalyst Project (/en/cli/v1/deploy-resources/introduction/) -------------------------------------------------------------------------------- # Deploy to console To train and test the configured ecommerce bot in ConvoKraft from the console, you will first need to deploy the project to the console. 1. To {{%link href="/en/cli/v1/deploy-resources/introduction/" %}}deploy your Catalyst project{{%/link%}} from the CLI, run the following command in your terminal from your project directory : {{%cli%}}catalyst deploy{{%/cli%}} <br /> After you deploy the functions directory it will available under the Serverless Functions component of the Catalyst console. <br /> 2. Click on the function name {{%bold%}}ecommerce_function{{%/bold%}}. Switch to the {{%bold%}}Code{{%/bold%}} tab. You can edit the function from here and click {{%bold%}}Save{{%/bold%}}, if required. <br /> 3. Switch to the **Configuration** tab and expand the **Environmental variables** tab. Click **Create Variable**. <br /> 4. Provide the key as {{%badge%}}client_id{{%/badge%}} and add the value of ClientID that we have saved earlier in {{%link href="/en/tutorials/ecommerce-bot/nodejs/register-client" %}}this step{{%/link%}} as Development value here. Click **Save**. <br /> Similarly you must create the following environmental variables: <table class="content-table"> <thead> <tr> <th>Key</th> <th>Development Value</th> </tr> </thead> <tbody> <tr> <td>{{%badge%}}client_secret{{%/badge%}}</td> <td>Value fetched from the API console</td> </tr> <tr> <td>{{%badge%}}auth_url{{%/badge%}}</td> <td>https://accounts.zoho.com/oauth/v2/auth</td> </tr> <tr> <td>{{%badge%}}refresh_url{{%/badge%}}</td> <td>https://accounts.zoho.com/oauth/v2/token</td> </tr> <tr> <td>{{%badge%}}refresh_token{{%/badge%}}</td> <td>Value fetched from the API console</td> </tr> <tr> <td>{{%badge%}}crmapiurl{{%/badge%}}</td> <td>www.zohoapis.com</td> </tr> </tbody> </table> {{%note%}}{{%bold%}}Note :{{%/bold%}} 1. The {{%badge%}}client_secret{{%/badge%}} and {{%badge%}}refresh_token{{%/badge%}} values are the credentials generated in {{%link href="/en/tutorials/ecommerce-bot/nodejs/register-client" %}}this step{{%/link%}}. 2. For the {{%badge%}}crmapiurl{{%/badge%}}, {{%badge%}}auth_url{{%/badge%}}, {{%badge%}}refresh_url{{%/badge%}} values, please make sure to add your DC specific URLs.{{%/note%}} Before we proceed to host the client, we need to associate the created Catalyst function with our Convokraft bot. Please make sure you follow the steps listed below. Navigate to the ConvoKraft service and click {{%bold%}}EcommerceBot{{%/bold%}}.The Bots Details page will be displayed. Click {{%bold%}}Edit Details{{%/bold%}} as shown in the screenshot below: <br /> In the Edit Bot dialog box, select the {{%bold%}}ecommerce_function{{%/bold%}}, choose {{%bold%}}At the end of an action context{{%/bold%}} and click {{%bold%}}Save{{%/bold%}}. <br /> Navigate to the {{%bold%}}Cloud Scale{{%/bold%}} service by clicking on its icon from left pane of the Catalyst console as shown in the screenshot below. Click {{%bold%}}Web Client Hosting{{%/bold%}}. You can access the hosted client URL from here. To learn more about the web client hosting component, you can check out {{%link href="/en/cloud-scale/help/web-client-hosting/implementation/" %}}this page{{%/link%}}. -------------------------------------------------------------------------------- title: "Train and test the bot" description: "Configure a conversational sales assitant bot for an ecommerce website using Catalyst ConvoKraft, Serverless Integration functions, and Zoho CRM that will interact with the website users, and manage their orders." last_updated: "2026-03-18T07:41:08.724Z" source: "https://docs.catalyst.zoho.com/en/tutorials/ecommerce-bot/nodejs/train-and-test-the-bot/" service: "All Services" related: - Project Directory Structure (/en/cli/v1/project-directory-structure/introduction/) -------------------------------------------------------------------------------- # Train and Test the Bot After you create the required actions and configure the business logic for them, you can {{%link href="/en/convokraft/help/manage-a-bot/train-a-bot/" %}}train{{%/link%}} and test the bot with all the actions from the Bots Details page by clicking {{%badge%}}Train{{%/badge%}} and {{%badge%}}Test this bot{{%/badge%}} respectively. <br /> You can either choose to pick a task from the suggestion shown or initiate a fresh conversations in the chat window. To learn more about {{%badge%}}Test this bot{{%/badge%}} feature, please refer to {{%link href="/en/convokraft/help/manage-a-bot/test-a-bot/" %}}this page{{%/link%}}. Click **list the items available in the store**. <br /> The bot fetches the list from the {{%badge%}}EcomProducts{{%/badge%}} CRM module and displays it to the user. <br /> You can view the list of items available and make a note of the required product IDs in order to place an order in the next step. <br /> Next, click **I want to place an order**. Provide the details prompted by the bot such as the Product ID, email address and the delivery address. <br /> The order has been successfully placed now. <br /> Please make a note of the orderID, in order to use it to check further details of your order with the EcommerceBot. Now, lets try to view our order details. Click **View my Order**. Provide the email address associated with your order. <br /> The order details has been fetched from the {{%badge%}}Orders{{%/badge%}} CRM module. Similarly, you can reschedule your order to a later date by clicking on the relevant suggestion. You can also type in your query directly to chat with the bot. <br /> The order has been rescheduled successfully. Similarly, you can also change the delivery address of your order, if required. <br /> The order has been updated with its new delivery address now. Now, we have successfully tested our bot in the development environment. We will be deploying it to production in the next section. -------------------------------------------------------------------------------- title: "Deploy to production" description: "Configure a conversational sales assitant bot for an ecommerce website using Catalyst ConvoKraft, Serverless Integration functions, and Zoho CRM that will interact with the website users, and manage their orders." last_updated: "2026-03-18T07:41:08.725Z" source: "https://docs.catalyst.zoho.com/en/tutorials/ecommerce-bot/nodejs/deploy-to-production/" service: "All Services" related: - Project Directory Structure (/en/cli/v1/project-directory-structure/introduction/) -------------------------------------------------------------------------------- # Deploy to Production After you have tested the ecommerce bot in the development environment, you can proceed to {{%link href="/en/deployment-and-billing/environments/introduction/" %}}deploy the bot to the production environment{{%/link%}}. This is done by {{%link href="/en/convokraft/help/manage-a-bot/deploy-a-bot/" %}}deploying the specific ConvoKraft bot{{%/link%}} alone, and then the entire project to production to enable the deployment of the associated function. 1. To deploy the bot to the production environment, navigate to the Bots Details page and click **Deploy to Production**. <br /> 2. In the *Deploy to Production* dialog box, enable **Include Catalyst Function Properties**. Choose the required release type and click **Deploy**. <br /> 3. After you have deployed your bot to production, you can switch to the production environment directly from the console, as shown in the screenshot below. <br /> You can now check the {{%link href="/en/convokraft/help/manage-a-bot/usage-stats/" %}}usage stats{{%/link%}} of your bot after you start using it by clicking the **Usage stats** tab in the bot's Details page. To learn more about usage stats, please refer to {{%link href="/en/convokraft/help/manage-a-bot/usage-stats/" %}}this page{{%/link%}}. <br /> {{%note%}}{{%bold%}}Note:{{%/bold%}} The {{%bold%}}Client{{%/bold%}} and {{%bold%}}Usage stats{{%/bold%}} tabs are only enabled in the production environment.{{%/note%}}