Shopify Customer Service Chatbot using Python Automation

Nicholas Renotte · Beginner ·🖊️ Copywriting & Content Strategy ·6y ago

Key Takeaways

The video demonstrates how to create a Shopify customer service chatbot using Python automation, Watson Assistant, and Shopify API, enabling businesses to boost their customer service game and provide a better customer experience. It covers setting up API access, handling customer enquiries, and integrating the chatbot with the Shopify store.

Full Transcript

tired of a sucky customer experience ain't everybody now customer experience can be one of the toughest things to get right but one of the easiest ways to improve your customer experience is to add a virtual agent or a chat bot now this could be to your ecommerce store to your website to your Facebook page on a whole bunch of other channel specifically today we're going to be going through how to add a customer service chat bot to your Shopify store so if you've got a Shopify store a customer would be able to enter in their order number and get the status of their order in return ideally boosting your customer experience by a whole heap let's get to it so we're gonna start off with in our Shopify store now if you've already got a show up at a store all you need to do is log in into the backend and you'll be able to see what I'm looking at at the moment now I've got a couple of dummy orders within my store that's going to be important because ideally what we're going to be taking a look at is trying to get back the status from each one of these orders so we're really going to be taking a look at payment and fulfillment as well as whether or not that particular order has been confirmed now there's a few moving parts so let's take a quick look at how this is all going to fit together now there's a couple of moving parts of these tutorials what you need set up as a prerequisite is an IBM cloud account and a Shopify store that way we've got everything ready to go once we're ready to go let's get back to it now the first thing that we're going to be doing is creating API access to our Shopify store so API access is going to allow us to get the order status get the fulfillment status and a whole bunch of other goodness what we're going to be doing to test that API is we're going to be using postman so postman is a free app you can use it and you can do a whole bunch of really cool stuff with it so we're going to be testing all of our API is using postman and just to make sure everything works so first things first let's create this API access so in order to create API access we need to create a private app so to do that we can go into apps and then we can go to manage private apps and then create a new private up and we're just going to call this what's in assistant what's in assistant uh yeah that'll work and then we'll just type in developer email so I'll just type in my own email and then we just need to make sure that we've got API access to our orders so if you expand that and just scroll down we just want to go to orders transactions and fulfillments and we just need to go read access so if we change that order that status from no access to read access that will allow us to grab the information that we need all right and then if we scroll all the way down and just hit save then create up perfect so we've now just created API access to our store now from within this panel we've actually got a really really simple integration path so we just need to copy this URL be careful not to share these API details anyone else you don't want these going around I'm showing them here that this store will be gone so just grab that particular URL and we're gonna go jump into postman and what you can do is you can test out that URL so that that particular stream that we've got is going to allow us to get API information to all of our orders so if we take that URL and just hit send you can see we've got all the information for all of our audits now there's only two so if we collapse this you can see that we've only got two orders in here but that's all well and good that gives us the information that we're going to need now each one of these orders actually has an order ID attached to it we're going to use that order ID to check our order status from our Watson assistant once we set that up now we can actually use that or add order ID to query just a single order using this a similar URL to what we're seeing up here so what we'll do is we'll take this order ID and we'll just add in or remove jason added another slash paste that order ID and then just add in jason after that and now we've got the status for that single if you can see here we've only got a single order now so this particular string is what we're going to be using in our function to or our webhook in order to query a Shopify store now let's jump onto that so in order to create our function we just need to step into IBM cloud now from IBM cloud we can just type in functions and select this function service so this is going to allow scrape or use serverless functions and build web hooks to start building a bunch of integration so we've already got a server set up so we just need to hit start creating and when we create our web hook we're just going to select an action and we're going to call this Shopify function and we'll change our runtime to Python so I feel more comfortable coding in JavaScript or Ruby or Swift or PHP or even go feel free to change it to whatever you want we're going to use Python to sort of stick with the theme of the channel and hit create now there is a little bit of code involved here but it's pretty simple so really all we're going to be doing here is we're going to use our Python code to make a request out to our Shopify API and then we're going to bring back some information and return that as a result if we're successful so in order to do that we're going to need a few extra libraries so it will going to import requests and we're also going to import JSON now remember when we made our API call we actually sent through an order ID as part of that that request we want to be able to make that same API call the dynamically pass through the order ID to this function now we can do that using parameters so we're just going to change this argument to params and when we test this out we'll be able to pass through an order ID and send that through to our URL okay now what we're going to do is we're going to create a very for a URL and that variable is going to be this entire string that we created from our Shopify store so we'll create a variable which is call it URL now rather than leaving our order ID here we're actually going to pass that through as a parameter so we're just going to change that and we're going to apply some string formatting there and we're going to remember we said we're going to create a parameter and that parameter is going to have an order ID so when we access or when we pass through that parameter which we'll take a look at in a second we're actually going to be passing that order ID through to this URL let's just we've got an extra one there through to this URL and we're effectively going to be recreating this request now that we've got that URL we actually need to make a request and this is where the requests library comes in the one that we imported up here so we're going to make a request from Shopify so we'll add in a comment and we're going to make a request and we're going to request that URL now we want to do a little bit of error tracking when we're passing the results of this web action so we're going to just make sure that our status code is correct so a status code at 200 is a valid request no errors anything apart from that is probably going to be an error so we're going to just set up our conditions like that so we're going to say if dot status code doesn't equal 200 then we're going to return an error that's all don't say status code status dot status code and we'll also include our headers and then we'll include the body of our response as well and this is really just going to be the message that we want to send back and we're just going to send back a message saying there's an error error processing your request all right so that's handled out errors now we need to handle our positive response so if we have no issues then we're going to return a similar message so let's just copy this except this time rather than returning a error we're just going to pass our response so for that we're going to use the JSON library to process that so we can type in json dot loads and that's going to return a valid adjacent object for the body of our request and we can delete this line down here perfect so that's really it in terms of our function so this will now allow us to make a call to our Shopify store get some information back and bring that back eventually we're going to pass that through to our what's in a system so let's quickly test that up so we'll save it and then what we'll do is we'll invoke it with parameters now remember we said we're going to pass through the order ID we can do that by typing in order ID and then passing through the order ID that we want in this case we'll use this one and we'll paste that there so if we hit apply we can then make that API call so let's double check that works and you can see we've got the status from our order so we've got our order we've got whether or not it's being canceled whether or not it's being confirmed all that good stuff so that's great so our function currently works but we also need to make sure that our function is available to be accessed from the web so we can do that simply by going through two endpoints and selecting enable as web action then we just need to hit save then we can take this same function here or this same URL and again let's test this out in postman so if we create a new request in postman paste that in here we just need to pass through our parameter and we're going to take this order ID here and you can see that's worked perfectly fine so that's looking good for now so we've now set up integration into Shopify we've connected it to an IBM function now all we need to do is the easy bit so set up the integration into what's an assistant and then deploy so we can do that so let's go to IBM cloud and then what we'll do is we'll set up a new instance of what's an assistant so if we go to catalog then services then a I and select what's an assistant now what we're going to do is just choose the plus trial pricing plan there's a whole bunch of others choose whichever one you want but plus trial is going to be the easiest in terms of integration with Shopify later on you can just copy your web script makes your life super easy we're just going to do that for now so let's select plus trial and hit create and then we'll select launch what's an assistant and then select my first skill then what we want to be able to do is we want to be able to extract an order ID whenever a customer enters that into our assistant so we can do that using pattern matching with entities so if we create a new entity we'll just create an entity and we'll call it order ID if we keep create there we can then create a new one and then this is where the pattern matching comes in so if we select patterns and then we just need to type in a little bit of reg X so it's pretty simple so every single order idea that we get from Shopify is going to be 13 digits so in this case we're just going to do a match for that so we'll include a carrot then a digit so then we want to look for 13 digits and then we'll finish that off so if we add that there now when we test out our assistant it should be able to pick up those 13 digits for an order ID so as soon as this finishes training we should be able to test that out so we can now take our order ID that we had up here and paste it here so you can now see we've now picked up our entity which is order ID we can then take this order ID and use it within our dialog so if we step back we can go to dialogue and then we're going to keep this pretty simple so we'll add a node and we'll call that node order status now what we want to do is we want to check if our system has detected an order Ally and if that is the case then we're going to return back to status so we'll call that to our web hook we'll get that status and then we're going to return a result but first up let's make sure we can handle this order ID so if this particular node sees an order ID let's just search spawned order ID detected so now if we paste that in here you can see we've detected our order ID so that's all working fine so we've got our dialog set up we can detect an order ID now what we need to do is make sure we can integrate with our web hook so we created our function we set it up as a web hook or enabled it as a web action now what we want to do is we just want to be able to make sure that we can access that web hook using what's in a system to do that all we need to do is take the same URL that we used here and two options within our assistant paste our URL in here then if we go back to our dialog we can make a call out to that web book which is the same as us making a request using postman so once we step into our order status node we can select Customize turn on web hooks hit apply and then remember we want to send through our parameter to our web hook which is going to be our order ID so what we need to do is make sure we send out a parameter and this case is going to be order ID and then we want to be able to extract our order ID that ID user as input so to do that we're just going to use a bit of spell so we can enter in a left bracket question mark order ID and then we can access the value using dot literal so we're accessing the literal property then that will allow us to grab our order ID and then let's make sure that we can pass this Web book result so we'll delete that last bit of text that we were responding with which is order ID detected we can remove that we don't need that anymore and then we're just going to initially return success if we make a call to our API successfully and fail if we have any issues all right let's try that up so let's paste in our order ID again and success all right so we've managed to successfully query our web book so now what we want to do is just return some of those values back to our user so what we can do is we can step into a web hook result node and this is going to be the result if we're successful rather than leaving in success we're going to type in status for order and then we should probably return that the order ID so we'll grab the order ID and then we'll return the literal then we also want to add in whether or not the orders being confirmed so we can grab that from our web hook result so again we'll use some spell we're going to add in a question mark and then access the order so this is just navigating the JSON response that we're getting back from our order status so we're going to access the order and then grab whether or not it's been confirmed and then what we'll also return back is whether or not it's been fulfilled and whether or not it's being paid so let's check whether or not it's been paid and paid is accessible through the financial status attribute so let's grab the financial status attribute and then whether or not the orders been fulfilled is available through fulfillment status so let's grab that perfect so now the response that we should get back assuming we have a successful API call is the order ID whether or not it's been confirmed and the financial status and the fulfillment status so that's looking all good let's save that and let's test this out again so ultimately if we have a successful API call rather than just receiving success will now receive all those details that we had within this particular node here now so let's copy our order ID paste that in you can now see we have looks like that confirmed now it's got some issues let's double check that should be changing this to fulfilled perfect all right let's try that again so we're probably still not going to get any results back because our order hasn't actually been fulfilled so let's try that out though perfect so we've got whether or not it's been confirmed whether or not it's paid and whether or not it's fulfilled let's actually go in and for fill that order and we'll see the status change so it's this one and we'll mark it as fulfilled then if we come back and test that out again you can see that our orders now been fulfilled so in real time we're now getting live status updates now the last thing that we want to do is integrate this back into our Shopify store so we can do that pretty easily so we just need to go into our assistant step back in and then select add integration and for this integration we're just going to use web chat so we'll leave that integration why actually we will change our integration will call it Shopify and we'll hit create then all we need to do is scroll down to this chat UI script copy that then if we go back into our Shopify store what we need to do is go to online store and then select actions choose edit code and then we just to find the index liquid file so if we select that all we need to do is paste in our script there save it then if we hit preview you can now see that our assistant is now popping up so if we add it in our order ID let's copy that again and pasted that in we're now able to get our order status for each one of those orders and that about wraps up this tutorial and how to integrate what's an assistant with your Shopify store thanks so much for going through this tutorial hopefully you learned something new if you enjoyed this video be sure to like share and subscribe it and if you've got any questions at all be sure to drop a question in the comments below peace

Original Description

Tired of the same ol' sucky customer service? You're not alone! This video runs through how to boost your Shopify customer service game using Watson Assistant and Python Webhooks. I'll go through: - How to use Python Automation to get Shopify Order Status - Handling customer enquiries using Watson Assistant - How display a chatbot on your Shopify home page! Want to learn more about it all: Watson Assistant: https://www.ibm.com/cloud/watson-assistant/ Serverless Functions: https://cloud.ibm.com/docs/openwhisk?topic=cloud-functions-getting-started Postman: https://www.postman.com/ Get FREE stuff! Free Trials: https://cloud.ibm.com/catalog/services/watson-assistant Oh, and don't forget to connect with me! LinkedIn: https://www.linkedin.com/in/nicholasrenotte Facebook: https://www.facebook.com/nickrenotte/ GitHub: https://github.com/nicknochnack Happy coding! Nick P.s. Let me know how you go and drop a comment if you need a hand! Music: Ark · Ship Wrek · Zookeepers (https://youtu.be/rgxfky2vqw4)
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Nicholas Renotte · Nicholas Renotte · 29 of 60

1 Face Detection - Build An Image Classifier with IBM Watson - Part 7
Face Detection - Build An Image Classifier with IBM Watson - Part 7
Nicholas Renotte
2 Food Image Classification - Build An Image Classifier with IBM Watson - Part 6
Food Image Classification - Build An Image Classifier with IBM Watson - Part 6
Nicholas Renotte
3 General Image Classification - Build An Image Classifier with IBM Watson - Part 5
General Image Classification - Build An Image Classifier with IBM Watson - Part 5
Nicholas Renotte
4 Installing Watson Developer Cloud - Build An Image Classifier with IBM Watson - Part 4
Installing Watson Developer Cloud - Build An Image Classifier with IBM Watson - Part 4
Nicholas Renotte
5 Generating Credentials - Build An Image Classifier with IBM Watson - Part 3
Generating Credentials - Build An Image Classifier with IBM Watson - Part 3
Nicholas Renotte
6 Creating A Service - Build An Image Classifier with IBM Watson - Part 2
Creating A Service - Build An Image Classifier with IBM Watson - Part 2
Nicholas Renotte
7 Getting an IBMid - Build An Image Classifier with IBM Watson - Part 1
Getting an IBMid - Build An Image Classifier with IBM Watson - Part 1
Nicholas Renotte
8 How to Analyse Review Data - Part 2 - Python Yelp Sentiment Analysis
How to Analyse Review Data - Part 2 - Python Yelp Sentiment Analysis
Nicholas Renotte
9 How to Lemmatize Text - Part 4 - Python Yelp Sentiment Analysis
How to Lemmatize Text - Part 4 - Python Yelp Sentiment Analysis
Nicholas Renotte
10 How to Calculate Sentiment Using TextBlob - Part 5 - Python Yelp Sentiment Analysis
How to Calculate Sentiment Using TextBlob - Part 5 - Python Yelp Sentiment Analysis
Nicholas Renotte
11 How to Collect Business Reviews Using Python - Part 1 - Python Yelp Sentiment Analysis
How to Collect Business Reviews Using Python - Part 1 - Python Yelp Sentiment Analysis
Nicholas Renotte
12 How to Clean Text Based Data for NLP - Part 3 - Python Yelp Sentiment Analysis
How to Clean Text Based Data for NLP - Part 3 - Python Yelp Sentiment Analysis
Nicholas Renotte
13 How to Setup a IBM Watson Personality Insights Service - Part 1 - Watson Personality Insights
How to Setup a IBM Watson Personality Insights Service - Part 1 - Watson Personality Insights
Nicholas Renotte
14 How to Create a Customer Profile with IBM Watson - Part 2 - Watson Personality Insights
How to Create a Customer Profile with IBM Watson - Part 2 - Watson Personality Insights
Nicholas Renotte
15 Visualising The Profile   Part 3   Watson Personality Insights
Visualising The Profile Part 3 Watson Personality Insights
Nicholas Renotte
16 How to Plot Personality Insights Features at Lightspeed - Part 4  - IBM Watson Personality Insights
How to Plot Personality Insights Features at Lightspeed - Part 4 - IBM Watson Personality Insights
Nicholas Renotte
17 Getting Started With IBM Watson Studio Machine Learning - Part 1 - Predicting Used Car Prices
Getting Started With IBM Watson Studio Machine Learning - Part 1 - Predicting Used Car Prices
Nicholas Renotte
18 Upload and Visualize Data In IBM Watson Studio - Part 2 - Predicting Used Car Prices
Upload and Visualize Data In IBM Watson Studio - Part 2 - Predicting Used Car Prices
Nicholas Renotte
19 Clean Data and Feature Engineer in IBM Watson Studio - Part  3 - Predict Used Car Prices
Clean Data and Feature Engineer in IBM Watson Studio - Part 3 - Predict Used Car Prices
Nicholas Renotte
20 Using Watson Model Builder to Predict Car Prices - Part 4 - Predicting Used Car Prices
Using Watson Model Builder to Predict Car Prices - Part 4 - Predicting Used Car Prices
Nicholas Renotte
21 Deploy and Make Predictions With Watson Studio - Part 5 - Predicting Used Car Prices
Deploy and Make Predictions With Watson Studio - Part 5 - Predicting Used Car Prices
Nicholas Renotte
22 Getting Started With IBM Watson Discovery - Part 1 - Stock News Crawler
Getting Started With IBM Watson Discovery - Part 1 - Stock News Crawler
Nicholas Renotte
23 How to Run Advanced Queries with Watson Discovery - Part 5 - Stock News Crawler
How to Run Advanced Queries with Watson Discovery - Part 5 - Stock News Crawler
Nicholas Renotte
24 How to Run Search Queries with IBM Watson Discovery - Part 4 - Stock News Crawler
How to Run Search Queries with IBM Watson Discovery - Part 4 - Stock News Crawler
Nicholas Renotte
25 How to Understand the Watson Discovery Data Schema  - Part 3 - Stock News Crawler
How to Understand the Watson Discovery Data Schema - Part 3 - Stock News Crawler
Nicholas Renotte
26 How to Build a Watson Discovery Web Crawler - Part 2 - Stock News Crawler
How to Build a Watson Discovery Web Crawler - Part 2 - Stock News Crawler
Nicholas Renotte
27 AI learns what to do next using Tensorflow and Python
AI learns what to do next using Tensorflow and Python
Nicholas Renotte
28 Chatbot Crash Course for Absolute Beginners - Full 20 Minute Tutorial
Chatbot Crash Course for Absolute Beginners - Full 20 Minute Tutorial
Nicholas Renotte
Shopify Customer Service Chatbot using Python Automation
Shopify Customer Service Chatbot using Python Automation
Nicholas Renotte
30 Building a Reddit Keyword Research Chatbot
Building a Reddit Keyword Research Chatbot
Nicholas Renotte
31 Chatbot App Tutorial with Javascript Node.js [Part 1]
Chatbot App Tutorial with Javascript Node.js [Part 1]
Nicholas Renotte
32 Javascript Chatbot From Scratch with React.Js [Part 2]
Javascript Chatbot From Scratch with React.Js [Part 2]
Nicholas Renotte
33 Predicting Churn with Automated Python Machine Learning
Predicting Churn with Automated Python Machine Learning
Nicholas Renotte
34 Sales Forecasting in Excel with Machine Learning and Python Automation
Sales Forecasting in Excel with Machine Learning and Python Automation
Nicholas Renotte
35 Automate Budgeting with Python and Planning Analytics
Automate Budgeting with Python and Planning Analytics
Nicholas Renotte
36 AI vs Machine Learning vs Deep Learning vs Data Science
AI vs Machine Learning vs Deep Learning vs Data Science
Nicholas Renotte
37 Optimizing Marketing Spend using Linear Programming || Marketing Opt PT.1
Optimizing Marketing Spend using Linear Programming || Marketing Opt PT.1
Nicholas Renotte
38 Solving Optimization Problems with Python Linear Programming
Solving Optimization Problems with Python Linear Programming
Nicholas Renotte
39 Loading Data into Planning Analytics with Python || Marketing Opt PT.2
Loading Data into Planning Analytics with Python || Marketing Opt PT.2
Nicholas Renotte
40 Building Marketing Dashboards with Planning Analytics Workspace || Marketing Opt PT.3
Building Marketing Dashboards with Planning Analytics Workspace || Marketing Opt PT.3
Nicholas Renotte
41 Optimizing Resource Allocation with Docplex and Planning Analytics || Marketing Opt PT.4
Optimizing Resource Allocation with Docplex and Planning Analytics || Marketing Opt PT.4
Nicholas Renotte
42 Exploratory Data Analysis With Pandas || Python Machine Learning PT.1
Exploratory Data Analysis With Pandas || Python Machine Learning PT.1
Nicholas Renotte
43 Preparing Pandas Dataframes for Machine Learning || Python Machine Learning PT.2
Preparing Pandas Dataframes for Machine Learning || Python Machine Learning PT.2
Nicholas Renotte
44 Python Machine Learning with Scikit Learn - Regression || Python Machine Learning PT.3
Python Machine Learning with Scikit Learn - Regression || Python Machine Learning PT.3
Nicholas Renotte
45 Deploying Machine Learning Models with Watson Machine Learning || Python Machine Learning PT.4
Deploying Machine Learning Models with Watson Machine Learning || Python Machine Learning PT.4
Nicholas Renotte
46 Mind Blowing Machine Learning Apps with Node.JS and Watson Machine Learning || Python ML PT.5
Mind Blowing Machine Learning Apps with Node.JS and Watson Machine Learning || Python ML PT.5
Nicholas Renotte
47 Build FAST Machine Learning Apps with Javascript React.Js and Watson || Python ML PT.6
Build FAST Machine Learning Apps with Javascript React.Js and Watson || Python ML PT.6
Nicholas Renotte
48 Analyzing Twitter Accounts with Python and Personality Insights
Analyzing Twitter Accounts with Python and Personality Insights
Nicholas Renotte
49 Converting Speech to Text in 10 Minutes with Python and Watson
Converting Speech to Text in 10 Minutes with Python and Watson
Nicholas Renotte
50 Build a Face Mask Detector in 20 Minutes with Watson and Python
Build a Face Mask Detector in 20 Minutes with Watson and Python
Nicholas Renotte
51 AI Text to Speech in 10 Minutes with Python and Watson TTS
AI Text to Speech in 10 Minutes with Python and Watson TTS
Nicholas Renotte
52 Pandas for Data Science in 20 Minutes | Python Crash Course
Pandas for Data Science in 20 Minutes | Python Crash Course
Nicholas Renotte
53 Language Translation and Identification in 10 Minutes with Python and Watson AI
Language Translation and Identification in 10 Minutes with Python and Watson AI
Nicholas Renotte
54 Analyse ANY Conversation in 10 Minutes with Python and Watson Tone Analyser
Analyse ANY Conversation in 10 Minutes with Python and Watson Tone Analyser
Nicholas Renotte
55 Deep Reinforcement Learning Tutorial for Python in 20 Minutes
Deep Reinforcement Learning Tutorial for Python in 20 Minutes
Nicholas Renotte
56 NumPy for Beginners in 15 minutes | Python Crash Course
NumPy for Beginners in 15 minutes | Python Crash Course
Nicholas Renotte
57 Real Time Pose Estimation with Tensorflow.Js and Javascript
Real Time Pose Estimation with Tensorflow.Js and Javascript
Nicholas Renotte
58 Transcribe Video to Text with Python and Watson in 15 Minutes
Transcribe Video to Text with Python and Watson in 15 Minutes
Nicholas Renotte
59 Serverless Functions for TM1/Planning Analytics in 20 Minutes
Serverless Functions for TM1/Planning Analytics in 20 Minutes
Nicholas Renotte
60 Building a AI Budget Bot for Planning Analytics with Watson Assistant in 20 Minutes
Building a AI Budget Bot for Planning Analytics with Watson Assistant in 20 Minutes
Nicholas Renotte

This video teaches how to create a Shopify customer service chatbot using Python automation and Watson Assistant, covering API integration, error handling, and chatbot deployment. By following this tutorial, businesses can improve their customer experience and provide a more efficient support system. The video also covers copywriting for chatbots and integrating assistants with e-commerce platforms.

Key Takeaways
  1. Create a private app in Shopify and set up API access
  2. Use Postman to test API and get order status
  3. Create a function using IBM Cloud to query Shopify store
  4. Use Python to make a request to Shopify API and return information as a result
  5. Pass order ID as a parameter to the function to dynamically query a single order
  6. Set up conditions to handle errors in API requests
  7. Use JSON library to process responses
  8. Enable function as web action to access from the web
  9. Set up integration into IBM Watson Assistant
  10. Deploy integration into Watson Assistant
💡 The key to creating an effective customer service chatbot is to integrate it with the e-commerce platform and provide a seamless customer experience. By using API integration and copywriting for chatbots, businesses can improve their customer support system and increase customer satisfaction.

Related AI Lessons

Up next
The Sales Formula That Changed Everything
The Payrollin' Podcast
Watch →