EbayBot Part 1: Getting search results
The British Heart Foundation eBay store is probably one of the most successful charity stores on eBay. It has thousands of listings of all kinds of interesting and unique items that have been donated to the BHF to raise money for life saving research into all kinds of heart conditions.
I wanted to build a Chatbot that could search the listings of a specific eBay store and return results based on a user inputted search term. The idea was simple; the bot asks the user what they are looking for, the user enters their search term, e.g. “camera”, and the bot returns all the listings on the BHF eBay store that match.
I broke the flow into three parts: Getting the search results, displaying the search results, and filtering the search results.
This was my first bot using an API to pull data from the web so I had a lot to learn about how to get the search results from eBay. And I didn’t really know how I was going to get the results to display in a chatbot, which listing info was essential and which I could do without, but I knew that with thousands of products on the BHF eBay Store at any one time, the third stage of filtering the listings was going to be essential for making the chatbot useful.
Getting the search results
I started by creating a developer account with ebay to get access to this suite of API’s.
Ebay has an API called ‘findItemsIneBayStores’ but I couldn’t get it to return results for the BHF store. A quick bit of Goggling showed that this API was known to be unreliable so I moved on to using the ‘findItemsAdvanced’ API.
This gave me greater control over the returning results which meant that I could pull results only for the correct store and get the elements I wanted to display to the user: Listing name, image, url on eBay. This API also allowed me to limit the number of returning results and display them in order of finished soonest first. Doing this would reduce the amount of filtering the user would have to do to find an item they were interested in.
So, when the flow was the started, EbayBot asks the user what they would like to search for. The users types ‘camera’
The bot then uses the eBay API to pull back data for active listings in the BHF store that contain the keyword ‘camera’.
Getting reliable search results returned in JSON format was great. Now I had all the data I needed.
The next steps
The next step will be to figure the best way to display these results to the user in the chat flow. I think it’ll probably be a set of image cards that show the listing title, an image of the product, perhaps the current price, and either a link to the listing on eBay or a button to look at a single listing in more detail. I think this user experience decision comes down to whether users are likely to be able to choose the listing they are looking for with the first set of results, which means sending them out of the flow to eBay would be fine, or if the first set of results doesn’t give them enough info to choose, in which case i wouldn’t want them bouncing back and forth between the bot and the eBay website so I’ll make it so they can go into expanded information for each listing. I might also have a look at whether there is a way to identify if they have the eBay app installed on their phone and if so open that rather than link to the website.