<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Yi Zhuang, Chew on Medium]]></title>
        <description><![CDATA[Stories by Yi Zhuang, Chew on Medium]]></description>
        <link>https://medium.com/@yizhuang-chew?source=rss-23c0312385bc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*J_Zu_R_d1AJIFjqL.jpg</url>
            <title>Stories by Yi Zhuang, Chew on Medium</title>
            <link>https://medium.com/@yizhuang-chew?source=rss-23c0312385bc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 10:07:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yizhuang-chew/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to Build a Commerce Chatbot with DialogFlow CX & commercetools (Step By Step)]]></title>
            <link>https://yizhuang-chew.medium.com/how-to-build-a-commerce-chatbot-with-dialogflow-cx-commercetools-step-by-step-51791e76eb75?source=rss-23c0312385bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/51791e76eb75</guid>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[commercetools]]></category>
            <category><![CDATA[commerce]]></category>
            <category><![CDATA[dialogflow]]></category>
            <dc:creator><![CDATA[Yi Zhuang, Chew]]></dc:creator>
            <pubDate>Wed, 03 Feb 2021 07:50:22 GMT</pubDate>
            <atom:updated>2021-02-03T08:13:57.362Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*x0WKKlhPz18pVI43" /><figcaption>Photo by <a href="https://unsplash.com/@christiannkoepke?utm_source=medium&amp;utm_medium=referral">Christiann Koepke</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Chatbots are great shopping assistants</h3><p>They enable businesses to create rich two-way interactions with their customers by:</p><ul><li>Increasing awareness of the brand, its products and ongoing promotions</li><li>Understanding the customer’s profile, context, interest and preferences</li><li>Filtering and presenting targeted options based on the customer’s profile</li><li>Serving up additional information and answer specific questions (e.g. store details) without forcing the customer to navigate from the page</li><li>Providing personalised recommendations for up-sell/ cross-sell opportunities</li><li>Adding items into the cart and assisting with the checkout process</li><li>Answering questions on the order and delivery times</li><li>Assisting with processing refunds and exchanges</li></ul><p>Additionally, there have been great advancements in the technologies in recent years to create these interactions.</p><ul><li>Chatbot frameworks have advanced rapidly to instantly understand customer&#39;s needs and can be integrated with ease to voice technologies and various messaging platforms (e.g. Facebook, Twilio, Line, Wechat).</li><li>Headless commerce platforms have replaced traditional desktop-focused ones and the decoupling of front and back-ends enables brands to serve up experiences across different touch-points including conversational UI.</li></ul><p>A commerce chatbot has the potential to create rich customer experiences throughout the whole customer journey. To try out its capabilities, I experimented with building a conversational commerce experience with <em>DialogFlow CX </em>(Google’s AI chatbot framework) and <em>commercetools</em> (leading platform for headless commerce) and this is how I did it.</p><h3>I Wanted the Chatbot to Perform 3 Functions</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xWQWSzxGDTI_DU-A8KOpGg.png" /></figure><p>At the end of this guide, we should be able to have a conversation with the chatbot similar to the one below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/783/1*OzWqPIO4LIxGmFqChUkAeg.png" /></figure><h3>Technologies Required</h3><p>To build this, I needed a few components.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*xLm6HOdqnnTkBP4wiMmJlg.png" /></figure><ul><li>Conversation UI: This is &quot;The Head&quot; (frontend) that the customer will interact with through talking/ chatting. In this guide, DialogFlow CX will be used to design and create the conversational user interface.</li><li>Custom Function: This is &quot;The Neck&quot; which are functions that host the business logic required for the conversation (e.g. integrating to backend services to retrieve information or trigger actions). In this guide, we will be writing a simple serverless function in Node.js hosted on Google Cloud Functions.</li><li>Commerce Platform: This is &quot;The Body&quot; (backend) that consists of technologies required to process the customer needs. They may include multiple technology platforms to serve up product information, promotion engines, customer management, payments processing etc. In this guide, we will focus on integrating with a commerce platform (for product price and cart calculations) and may explore connecting additional services (e.g. payment services, content management) at a later stage.</li></ul><h4>On the Technologies Chosen…</h4><h4>Conversational UI — DialogFlow CX</h4><p>DialogFlow CX is Google’s new product to build conversational interfaces. It provides a great set of toolkits for building out virtual agents to handle conversations. They include natural language understanding, identifying user intents and inputs, sentiment analysis, integrating with external services for fulfillments and much more.</p><p>There is also DialogFlow ES which I have considered using. It is an older version of DialogFlow which supports more languages and integrations (such as with Messenger, Slack, LINE, Telegram and several others).</p><p>I ended up choosing DialogFlow CX as the new visual state-based approach to building conversations made the process of building them closer to how a natural conversation would flow.</p><h4>Custom Function — Serverless Node.js on Google Cloud Functions</h4><p>To host the business logic, I went with Google Cloud Functions as it is also part of Google&#39;s Cloud offering.</p><p>Google Cloud Functions is a serverless, event-based computing service that allows you to create small, single-purpose functions which responds to cloud events without having to provision a server or runtime environment. The functions can be triggered via different cloud events including a direct invocation through an HTTP endpoint.</p><p>These functions can be developed in multiple languages (e.g. Node.js, Python, Go, Java, .NET, and Ruby). I went with Node.js in this case as javascript is now the world’s most popular programming language.</p><p>For this guide, I will be creating a custom function to host the business logic to trigger various actions via API to the commerce platform and return the information expected for the conversation.</p><h4>Commerce Platform — commercetools</h4><p>I develop with the commercetools platform all the time and hence it made perfect sense to have it as the commerce platform.</p><p>It is a perfect choice as well since commercetools is a MACH-based (microservices-based, API-first, cloud-native and headless) commerce engine and would be great for connecting the commerce experience across all different touchpoints. In this way, the same platform used to run the commerce experience for this chatbot can also be used to run another frontend such as the web/ mobile/ POS application to create a true “omni-channel” experience.</p><p>For this guide, it will be used to drive the commerce logic in particular the products prices and the cart calculation.</p><h3>To Build the 3 Functions…</h3><h3>1: Understand What the Customer Wants to Buy</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*z2LRt6E0rsmlybS3UO_fzQ.png" /></figure><p>In this section, we will be introduced to the basic concepts within DialogFlow CX and use them to identify what the customer is looking to purchase.</p><h4>1-a. Create an Agent</h4><blockquote>This is the virtual agent that handles conversations with your end-users.</blockquote><ul><li>Under the homepage of DialogFlow CX, click on <em>Create Agent</em>.</li><li>Choose the respective location and timezones and click on <em>Create</em>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HyNdWaAsdFW1pKCUWw4w-Q.png" /></figure><h4>1-b. Create a Purchase Flow</h4><blockquote>Complex dialogs often involve multiple conversation topics. <a href="https://cloud.google.com/dialogflow/cx/docs/concept/flow">Flows</a> are used to define these topics and the associated conversational paths.</blockquote><ul><li>On the left panel of DialogFlow CX, under Build-&gt;Flows, click on <em>‘+’</em> to create a new flow.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*XE_VjNoWFCwam40mRyRpKg.png" /></figure><p>I have created a Purchase Flow to group up the conversations related to a purchase. We can easily enhance this bot with other conversational paths in the future.</p><h4>1-c. Create a Route to Purchase Flow</h4><blockquote><a href="https://cloud.google.com/dialogflow/cx/docs/concept/handler#route">Routes</a> are called when an end-user input matches an <a href="https://cloud.google.com/dialogflow/cx/docs/concept/intent">intent</a> and/or some <a href="https://cloud.google.com/dialogflow/cx/docs/reference/condition">condition</a> on the session status is met.</blockquote><ul><li>Under Default Start Flow, click on <em>Start</em> (page) and under Transition Routes, click on <em>Default Welcome Intent</em>.</li><li>Update the <em>Condition</em> to always true and the Transition to <em>Purchase Flow</em>.</li><li>Save the Route.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OTKE75O2PIf0ODfSk42jrA.png" /></figure><p>After saving, you will notice that Default Start Flow now links to the new Purchase Flow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*f9cup-IvaxKiuEpZIAuZOg.png" /></figure><p>This will route the conversation to Purchase Flow when the conversation starts as the condition is set to be always true. More conditions can be added for routing in the future when additional conversation flows are added.</p><h4>1-d. Create a Page for Item Selection</h4><blockquote>A Dialogflow CX conversation (session) can be described and visualised as a <a href="https://en.wikipedia.org/wiki/Finite-state_machine">state machine</a>. The states of a CX session are represented by <em>pages</em>. For each <a href="https://cloud.google.com/dialogflow/cx/docs/concept/flow">flow</a>, you define many pages, where your combined pages can handle a complete conversation on the topics the flow is designed for.</blockquote><ul><li>Navigate to the newly created <em>Purchase Flow</em>.</li><li>Add a new Page called <em>Select Item </em>in the flow.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*NWOpWubKoytL-BNfDE3Hcg.png" /></figure><p>This will be the page used to identify the items they customer wants to purchase. There is also a lifecycle to the Page for fulfilment and user inputs which we will look at configuring later.</p><p>Eventually, the flow can be used to link up the different pages to complete the conversations such as in the example below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XYhFzdGOHVp94zOlU0pAIg.png" /></figure><h4>1-e. Create a Route to Select Item</h4><ul><li>Under the Purchase Flow, click on <em>Start</em> (page) and under Transition Routes, click on the <em>Default Welcome Intent.</em></li><li>Update the condition to always be true and the transition to the <em>Select Item</em> (page).</li><li>Save the Route.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JHUeCmEz17fykJb0c8_C5g.png" /></figure><p>Now within the Purchase Flow, we will always be routed to Select an Item.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/454/1*LwQYaLUf2saQnsB0vD3Lzw.png" /></figure><h4>1-f. Create a Parameter to Collect Inputs on the Selected Item</h4><blockquote>For each page, you can define a <em>form</em>, which is a list of parameters that should be collected from the end-user for the page.</blockquote><blockquote><em>Parameters</em> are used to capture and reference values that have been supplied by the end-user during a session. Each parameter has a name and an <a href="https://cloud.google.com/dialogflow/cx/docs/concept/entity">entity type</a>.</blockquote><blockquote>For each form parameter, you also provide <em>prompts</em> that the agent uses to request that information from the end-user.</blockquote><ul><li>Click on the Select Item Page (created in 1-d).</li><li>Add a parameter to store the Purchase Item: purchase_item.</li><li>Add in a prompt to request for the purchase_item parameter: What would you like to purchase?</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H8dWjHC6yLHEH7tdAyVt2w.png" /></figure><p>With this, DialogFlow CX will check for unfilled form parameters (in this case the purchase item) and wait for the user’s inputs.</p><p>There is based on the lifecycle of the Page and further details of the lifecycle can be referenced <a href="https://cloud.google.com/dialogflow/cx/docs/images/cx-page-lifecycle.svg">here</a>.</p><h4>1-g. Test it out</h4><p>We have now successfully created a Flow that is able to capture what the customer wants to purchase.</p><ul><li>Click on Test Agent</li><li>Talk to the Agent with the inputs below</li></ul><p>You will notice the purchase_item parameter being filled up. This will be used in the next step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*XELp_9YZSdqmJ_e7pNdAoA.png" /></figure><h3>2: Add Selected Item into the Customer’s Cart</h3><p>In this section, we will make use of a webhook to add an item into the customer’s cart (in commercetools) and retrieve the price of the product for display back to the customer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*NDEP--Zyl6GKkE092_xQCw.png" /></figure><h4>2-a. Create a Page for Add to Cart</h4><ul><li>Under the <em>Purchase Flow, a</em>dd a new Page called <em>Add to Cart </em>in the flow.</li></ul><p>This will be the page that adds the item into the cart which we will be configuring.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/1*DAheKAe7cm9y_iFVPGTGoQ.png" /></figure><h4>2-b. Create a Route from Select Item to Add to Cart when the Purchase Item is Provided</h4><ul><li>Click on <em>Select Item</em> (page) and add a new <em>Transition Route (+)</em>.</li><li>Update the condition to <em>$page.params.status = “FINAL”</em> and the transition to the <em>Add to Cart (p</em>age).</li><li>Save the Route.</li></ul><blockquote>The condition: $page.params.status = “FINAL” checks whether the current page’s complete form is filled.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2m0c3BmletUjyp_2QYTnSg.png" /></figure><p>You should now have a flow like this. Whenever the customer provides the purchase_item inputs in the conversation, the states will then transition from Select Item Page to the Add to Cart Page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*cY9z7FWok5TrJoZAXj8c7w.png" /></figure><h4>2-c. Add in the Agent Dialog after the Item is Added</h4><blockquote>For an agent’s conversational turn, the agent must respond to the end-user with an answer to a question, a query for information, or session termination. Your agent may also need to contact your service to generate dynamic responses or take actions for a turn. <em>Fulfilment</em> is used to accomplish all of this.</blockquote><blockquote>A fulfilment may contain: Static response messages, Webhook calls for dynamic responses and/or to take actions or Parameter presets to set or override parameter values.</blockquote><ul><li>Click on<em> Add to Cart</em> (page).</li><li>Under Entry Dialog, edit the Fulfilment to add in the Agent Dialog: <em>Nice choice! The item costs $session.params.purchaseItemPrice. Would you like anything else?</em></li></ul><p>You will notice a new parameter (purchaseItemPrice) being introduced into the dialogue. This will be dynamically setup through the webhook which we will create in the next step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PJ_Cw-p-x02AbB0R_TZ8Sw.png" /></figure><h4>2-d. Develop the Business Logic that Integrates with commercetools</h4><blockquote><em>Webhooks</em> are services that host your business logic. During a session, webhooks allow you to use the data extracted by Dialogflow’s natural language processing to generate dynamic responses, validate collected data, or trigger actions on the backend.</blockquote><p>For this, the Webhook will host the business logic that makes the API call to commercetools to perform some actions (e.g. add item to cart) and generate dynamic responses (e.g. product prices and total cart prices) that will be used for the conversation.</p><p>This step requires some basic understanding of the commercetools APIs and SDKs, usage of Google Cloud functions and a programming framework (e.g. Node.js) to write the business logic for the function.</p><ul><li>As a prerequisite, we will need a commercetools environment with an API client and some basic product data. For steps to getting started on commercetools, refer to this <a href="https://docs.commercetools.com/tutorials/getting-started">guide</a>.</li><li>For this example, I have written a simple function on Node.js. The function can be found in this repository <a href="https://github.com/yizhuang-chew/dialogflow_functions.git">here</a>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D818391bzseMwPy4L62t8Q.png" /></figure><p>I have broken the code snippet down to do the following:</p><ul><li>Reads the Inputs from the Webhook Request (e.g. Selected Item) from DialogFlow</li><li>Trigger Actions to commercetools (Create a Cart if it does not exist and Add the Item Selected to the Cart)</li><li>Return a Webhook Response with the Cart and Item Information (e.g. Total Price)</li></ul><p>Note: There is a certain format of response that DialogFlow is expecting for the parameters setup. As there is no fulfilment libraries available yet for Dialogflow CX as of this moment, I have built out the service by referencing the <a href="https://cloud.google.com/dialogflow/cx/docs/reference/rpc/google.cloud.dialogflow.cx.v3beta1#webhookrequest">webhook request</a> and <a href="https://cloud.google.com/dialogflow/cx/docs/reference/rpc/google.cloud.dialogflow.cx.v3beta1#webhookresponse">webhook response</a>.</p><ul><li>Finally, as the Webhook has to be a publicly available HTTPS URL, it will have to be hosted. There are multiple ways to host the Webhook and for this example, I have made used of Google Cloud Functions. The function can be easily hosted via the <a href="https://cloud.google.com/functions/docs/quickstart#deploy_a_function">gcloud Command-Line Tool</a> or by assessing <a href="https://console.cloud.google.com/functions/">Cloud Functions of the GCP Console</a>.</li></ul><p>For example, we can make use of the following command to host the function written: <em>gcloud functions deploy dialogflow_addtocart — entry-point addToCart — runtime nodejs12 — env-vars-file .env.yaml — trigger-http</em></p><p>Alternatively, it can be done through the GCP Console. This is also where we can have an easy view of the trigger URL which we will use in the next step to create the Webhook on DialogFlow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*A0DRkdOuZyWjCueE4W9OCQ.png" /></figure><h4>2-e. Call the Webhook in DialogFlow</h4><ul><li>On the Manage Panel, click on Webhooks. Click on Create.</li><li>Fill in the relevant information for the webhook (as per below).</li><li>Replace the Webhook URL with the trigger URL of the function you have hosted in 2-d.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rXnXgcjGplXNMQr_hK25uA.png" /></figure><h4>2-f. Add the Webhook to the Fulfilment</h4><ul><li>Click on Add to Cart (page). Under Entry Dialog, Edit the Fulfilment.</li><li>Select Use Webhook and Select the Webhook Created.</li><li>Save the Fulfilment.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7k4jufH3vfuUCIecBkA-Ig.png" /></figure><h4>2-g. Test it out</h4><p>We have now successfully created a Flow that is able to integrate with commercetools to add an item into the cart and return the product price and cart total price.</p><p>You will notice the following parameters being filled up from the webhook.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*5q7dY6xUOjo0MZgpJvGEUg.png" /></figure><h3>Step 3: Finalise Purchase and Display Total Cart Totals</h3><p>In this section, we will look at finalising the cart and displaying the total price using the response from Step 2. Additionally, we will also look at how we can further enhance the conversation with routes for scenarios when the customer replies Yes or No.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/1*aeOCSx9Kq42d1OIln1Mimw.png" /></figure><h4>3-a. Create a Page called Finalise Cart</h4><ul><li>Under the <em>Purchase Flow, a</em>dd a new Page called <em>Finalise Cart </em>in the flow.</li></ul><p>This is the page when the customer replies No (there are no additional items they would like) and would like to proceed with finalising the cart.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*SDF8vdGQvYcx835rSZYm3w.png" /></figure><h4>3-b. Create an Intent to Capture when the Customer Means No</h4><blockquote>An <em>intent</em> categorizes an end-user’s intention for one conversation turn.</blockquote><ul><li>On the Manage Panel, click on Intent. Click on <em>Create</em>.</li><li>Fill in the relevant information for the Intent (as per below).</li><li>For the training phrases, you can manually type training phrases that represents no or upload the list from <a href="https://github.com/yizhuang-chew/dialogflow_functions/blob/master/intent/ConfirmationNo.txt">here</a>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qDYHu9r30b5S0y9VlSVgeA.png" /></figure><h4>3-c. Create a Route from Add to Cart to Finalise Cart when the Customer Indicates No</h4><ul><li>Click on <em>Add To Cart</em> (Page) and add a <em>Transition Route (+)</em>.</li><li>Select the <em>Confirmation.No</em> Intent that was created in 3-b and Select <em>Finalise Cart</em> as the Page to Transition to.</li><li><em>Save</em> the Route.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*ddOIDcswI-H0TUZl2v9Txg.png" /></figure><h4>3-d. Add in the Agent Dialogue on Finalise Cart</h4><ul><li>Click on <em>Finalise Cart</em> (page) and click on <em>Edit Fulfilment</em> under Agent Dialogue.</li><li>Type in the Agent dialogue: <em>This is the Cart Total: $session.params.cartTotalPrice</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*A9aHkjr-HJ8g2-QKHmULEg.png" /></figure><h4>3-e. Create a Page called Select Additional Item</h4><p>Next, we will create another conversational path for the scenario when the customer says Yes (they would like an additional item).</p><ul><li>Create a new Page called <em>Select Additional Item</em>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*Pnv0HgM9LdgYaA5xkhnYgw.png" /></figure><h4>3-f. Create an Intent to Capture when the Customer Means Yes</h4><ul><li>On the Manage Panel, click on Intent. Click on <em>Create</em>.</li><li>Fill in the relevant information for the Intent (as per below).</li><li>For the training phrases, you can manually type training phrases that represents yes or upload the list from <a href="https://github.com/yizhuang-chew/dialogflow_functions/blob/master/intent/ConfirmationYes.txt">here</a>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fdTlEeFt8amTLvRfYR6sig.png" /></figure><h4>3-g. Create a Route from Add to Cart to Select Additional Item when the Customer Indicates Yes</h4><ul><li>Click on <em>Add To Cart</em> (Page) and add a <em>Transition Route (+)</em>.</li><li>Select the <em>Confirmation.Yes</em> Intent that was created in 3-f and Choose <em>Select Additional Item</em> as the Page to Transition to.</li><li><em>Save</em> the Route.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/998/1*zMB6sIqTIz8gs3wTR6l8Rw.png" /></figure><h4>3-h. Create a Parameter to Collect Inputs on the Additional Item</h4><ul><li>Click on Select Additional Item (Page) and click on Edit Fulfilment under Entry Dialogue.</li><li>Clear the <em>purchase_item</em> and <em>purchaseItemPrice</em> parameter filled in by pre-setting it to <em>null</em>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*Ms1JTwHCv1iY_N376I9QRQ.png" /></figure><ul><li>Navigate back to <em>Select Additional Item </em>(Page).</li><li>Add in a Parameter to capture the new item to be purchase: purchase_item</li><li>Add in the Agent Dialogue to prompt for the parameter: <em>What would you like to add to your cart?</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*nM6tqbcG2R-Dq96NiseTMQ.png" /></figure><h4>3-i. Create a Route from Select Additional Item to Add to Cart when the Additional Purchase Item is Provided</h4><ul><li>Click on <em>Select Additional Item </em>(Page) and add in a <em>Transition Route (+) </em>to route the conversation back to Add to Cart (Page) once the new item has been provided.</li></ul><blockquote>To check whether a particular form parameter was filled in the last turn, use the following condition:</blockquote><pre>$page.params.parameter-id.status = &quot;UPDATED&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*S8xJTHIc8CeneLMlhXTsjQ.png" /></figure><p>You should now have a flow like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZeP6sOE7sozXrqi6eOcvIg.png" /></figure><h4>3-j. Test it out</h4><p>We have now successfully created a Flow that is able to return the finalised cart details and also another conversational path to add an additional item into the cart.</p><p>Test it out with the simulator. You will notice that on providing inputs Yes or No, the conversation will be routed to prompt for another item or present the final cart totals accordingly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*lfEldS90WBCo97DTIL6hww.png" /></figure><h3>Conclusion</h3><p>Those were simple 3 steps to build out a simple commerce chatbot. I hope this has provided you with some insights to building conversational commerce experiences with DialogFlow CX and commercetools.</p><p><strong>To end off, I would like to share some insights to the experiences a commerce chatbot can potentially bring to your customers.</strong></p><p>As the world quickly pivots to a digital-first approach, with contactless or low-touch interactions. The advice, education and recommendations we get with a sales assistants in a brick and mortar stores becomes a thing of the past. In its place, we get long product listings and details pages that seeks to self-service our research process and automated marketing messages and banners to influence our purchase decision. There is a <strong>lack of personalised recommendations based on the customers needs and customers are not guided to assess the exact information they are looking for</strong>.</p><p>Additionally, there are businesses (commonly in the B2B space) where their customers are used to the convenience of placing orders via direct messages or emails to their sales representative and are looking to <strong>provide their customers with the same offline experience they are used to in an online environment.</strong></p><p>A chatbot can instantly understand the customer behaviours and needs and this can be further enhanced with integrations to customer data platforms to provide context and serve up personalised recommendations. Additionally, they can process these requests and provide the resolutions at a fraction of the time needed by human support. These capabilities enables commerce chatbots to create rich customer experiences throughout the whole customer journey.</p><p><strong>Commerce chatbots a powerful tool to bridge the disconnect between an eCommerce shop and the customer and should be adopted to serve as a virtual advisors in the next generation of commerce.</strong></p><h4>Ideas for Future Expansion</h4><p>Additionally, I will be looking to add more conversation flows to the chatbot in the future to include:</p><ol><li>Display of Catalog and Products Q&amp;A</li><li>Providing Personalised Recommendations</li><li>Customer Checkout</li><li>Full Checkout Flow with Shipping Details and Payments</li><li>Enquiries on Past Orders</li><li>Processing Refunds/ Exchanges</li></ol><p>Feel free to reach out if there are other interesting use cases that could be achieved with a commerce chatbot.</p><p>Icons made by <a href="https://www.flaticon.com/">Flaticon</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=51791e76eb75" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>