Can a chatbot add items to a web store cart using APIs?

Can a chatbot add items to a web store cart using APIs?

cshape
Visitor
2 0 0

Hi All,

I want to build a chatbot experience available to consumers shopping on a web store. I've got the bot nicely answering questions and querying the product APIs to display carousels, etc.

My question is:

Can the bot (which is placed into the store theme via a JS snippet) add items to the cart? If so, which API would I use?

If the user sees an item they like in the bot, I want a button which could add the item to their cart on the website.

I see that I could use the Storefront API, but I need to specify an ID for the cart. Is that the ID that I could get from the AJAX API? If so that could be handy, as I reckon I have the ability to pass that value from the store website into the bot.

Any other ideas on how to accomplish this would be much appreciated! Thanks!

Reply 1 (1)

cshape
Visitor
2 0 0

If anyone comes across this, the best I could figure out for my use case was having the bot make a custom cart/checkout URL with parameters for the product variants in the cart.

This works nicely if the user is doing everything through the bot, and so would be ideal on Whatsapp, Facebook Messenger, Google Business Chat, etc.

However, it's a bit sketchy for my use case as the user is already on the site. Weird behaviour could arise if the user is adding things to their cart both through the site and through the bot, so it's not completely ideal.