Hi Everyone!
Zoho SalesIQ's
Zobot is an intelligent tool to increase customer engagement and provide support, especially in the e-commerce industry. A crucial aspect of e-commerce is ensuring your customers can easily keep track of their orders. Just imagine your Zobot providing real-time updates on your customers' order status, tracking URL, shipment details, and estimated delivery dates. Sounds cool, right? That's what we are going to look at in this post.
Zoho Commerce is a comprehensive e-commerce platform for building a website, accepting orders, tracking inventory, processing payments, and more. With SalesIQ's Zobot seamlessly integrated with Zoho Commerce, you can now provide exceptional support and prioritize convenience for your customers by making your bot actively promote your key offers, assist in tracking orders, create support tickets, and much more.
Overview of tracking orders
Step 1 - Create a connection between SalesIQ and Zoho Commerce.
- In your SalesIQ Dashboard, navigate to Settings > Developers > Plugs > Click on Add.
- Provide your plug a name, and description, select the Platform as SalesIQ Scripts, and finally, click on Connection to your left bottom. You will be redirected to the connection interface.
- Click on Create connection at the top right corner. Under Default connection, select Zoho OAuth service.
- Provide your connection name, connection link name, and choose the scopes below.
- ZohoCommerce.salesorders.READ
- ZohoCommerce.items.READ
- Click on Create And Connect to connect Zoho SalesIQ and Zoho Commerce.
- Upon successful authentication, Zoho SalesIQ will be connected with Zoho Commerce.
Note: The Connection Link Name will be used in the scripts to invoke URL tasks.
Step 2 - Fetch the "Shipped" orders (Plug 1)
First, let's look at how to list all the shipped orders of the visitor from Zoho Commerce. To do this, we need the email address of the visitor. By
List all sales orders API, the bot can fetch all the orders from the visitors (email). Then using the status as a filter, all the Shipped orders can be fetched and displayed to the visitors as options.
Input Parameter:
- Name: email | Type: Email
Output Parameter:
- Name: orderList | Type : Options list
Copy/paste the below code to list all the shipped orders.
- response = Map();
- if(session.containsKey("email"))
- {
- email = session.get("email").get("value");
- }
- params = Map();
- params.put("email",email);
- params.put("page","1");
- params.put("per_page","5");
- header = Map();
- //Insert your Zoho Commerce Org ID (From your Zoho Commerce, navigate to the Store > Settings > Organization Profile > Organization ID)
- header.put("X-com-zoho-store-organizationid","<org_ID>");
- check_status = invokeurl
- [
- url :"https://commerce.zoho.com/store/api/v1/salesorders"
- type :GET
- parameters:params
- headers:header
- connection:"zohocommerce"
- ];
- array = check_status.get("salesorders");
- optionList = List();
- for each entry in array
- {
- salesorder_id = entry.get("salesorder_id");
- URL = "https://commerce.zoho.com/store/api/v1/salesorders/" + salesorder_id;
- get_order_details = invokeurl
- [
- url :URL
- type :GET
- headers:header
- connection:"zohocommerce"
- ];
- shipping_status = get_order_details.get("salesorder").toList().get(0).get("shipped_status").toUpperCase();
- //Printing the shipped orders
- if(shipping_status == "SHIPPED")
- {
- product_ordered = get_order_details.get("salesorder").get("line_items").toList().get(0).get("name");
- quantity = get_order_details.get("salesorder").get("line_items").toList().get(0).get("quantity").toNumber();
- display_text = product_ordered + " (" + quantity + ")";
- optionList.add({"id":salesorder_id,"text":display_text});
- }
- }
- response.put("orderList",optionList);
- return response;
- Then, click Save, preview the plug and Publish it.
Step 3- Getting order details (Plug 2)
In the previous step, we fetched all the "Shipped" orders and displayed them to the visitors. When they click on a specific order, the bot will get the order details from the
Retrieve sales order API and provide them to the visitor.
Input Parameter:
- Name : orderID | Type : String
Output Parameter:
- Name: shippingAddress | Type : String
- Name: deliveredDate | Type : String
- Name: orderName | Type : String
- Name: orderNumber | Type : String
- Name: quantity | Type : Number
- Name: orderCost | Type : Number
- Name: trackingUrl | Type : Options list
- Name: shippedDate | Type : Options list
- Name: paymentMode | Type : Options list
- Name: shippingStatus | Type : Options list
Copy and paste the below code to get the order details.
- if(session.containsKey("orderID"))
- {
- salesorder_id = session.get("orderID").get("value");
- }
- header = Map();
- //Insert your Zoho Commerce Org ID (From your Zoho Commerce, navigate to the Store > Settings > Organization Profile > Organization ID)
- header.put("X-com-zoho-store-organizationid","<ord_ID>");
- URL = "https://commerce.zoho.com/store/api/v1/salesorders/" + salesorder_id;
- get_order_details = invokeurl
- [
- url :URL
- type :GET
- headers:header
- connection:"zohocommerce"
- ];
- order_number = get_order_details.get("salesorder").toList().get(0).get("salesorder_number");
- product_ordered = get_order_details.get("salesorder").get("line_items").toList().get(0).get("name");
- cost = get_order_details.get("salesorder").get("line_items").toList().get(0).get("rate").toNumber();
- quantity = get_order_details.get("salesorder").get("line_items").toList().get(0).get("quantity").toNumber();
- payment_mode = get_order_details.get("salesorder").get("offline_payment_details").toList().get(0).get("payment_mode");
- shipping_address = get_order_details.get("salesorder").get("shipping_address").toList().get(0).get("address");
- tracking_url = get_order_details.get("salesorder").get("packages").toList().get(0).get("status_message");
- shipping_address = get_order_details.get("salesorder").get("shipping_address").toList().get(0).get("address");
- shipping_status = get_order_details.get("salesorder").toList().get(0).get("shipped_status").toUpperCase();
- if(shipping_status == "FULFILLED")
- {
- shipping_status = "Delivered";
- tracking_url = "No tracking URL";
- delivered_date = get_order_details.get("salesorder").get("packages").toList().get(0).get("shipment_date");
- shipped_date = get_order_details.get("salesorder").get("packages").toList().get(0).get("shipment_date");
- }
- else if(shipping_status == "SHIPPED")
- {
- shipping_status = "Shipped";
- tracking_url = get_order_details.get("salesorder").get("packages").toList().get(0).get("status_message");
- shipped_date = get_order_details.get("salesorder").get("packages").toList().get(0).get("shipment_date");
- delivered_date = get_order_details.get("salesorder").get("packages").toList().get(0).get("shipment_date");
- }
- else
- {
- shipping_status = "Yet to Ship";
- tracking_url = "No tracking URL available";
- shipped_date = "NA";
- delivered_date = "NA";
- }
- response = Map();
- response.put("orderNumber",order_number);
- response.put("orderCost",cost);
- response.put("orderName",product_ordered);
- response.put("quantity",quantity);
- response.put("shippingStatus",shipping_status);
- response.put("paymentMode",payment_mode);
- response.put("shippingAddress",shipping_address);
- response.put("trackingUrl",tracking_url);
- response.put("shippedDate",shipped_date);
- response.put("deliveredDate",delivered_date);
- return response;
- Then, click Save, preview the plug and Publish it.
Step 3 - Adding these plugs to the Codeless bot builder
- Navigate to Settings > Bot > Add, provide the necessary information, and select Codeless Bot as a bot platform or open an existing bot.
- To list the shipped orders, get the email address from the visitor by email card.
- Then, select the Plugs under Action Cards and select listShippedOrder (Plug 1). In the input parameters, select the Email context variable and provide a name (tracking.order) to save the list of shipped orders.
- Next, use the Single choice card to display all the shipped orders. Provide an option "Can't find my order" and click on dynamic suggestions and select the (tracking.order) variable.
- Next, click on Save in bot context (post.tracking.order) and store the visitor's order choice.
- Then, use the criteria router to route the flow based on the visitor's choice.
- After that, select the orderDetails plug in Plug card. And provide the post.tracking.order as the input and provide names for the outputs.
- Finally, use these context variables by typing % in the Send message card to display the order details to track orders.
- Also, use the markups to provide the tracking URL as a hyperlink.
Bot Preview (Output)
- The bot will ask for the email address and then provide the "shipped" orders list.
- Then the visitor selects one order, and the bot will provide the information about the order.
- Once the bot flow is complete, click Publish to deploy Zobot on your website or online store. Zobot will be ready to engage with your customers, provide support, and assist with their purchasing journey.
Related links: