How to build a basic pizza delivery bot with ActiveChat and Google Sheet

Publicerad: 5 maj, 2020

pizza-1ActiveChat is a very powerful tool to build helpful services in Facebook Messenger, Telegram and as a standalone Widget on your website.
With ActiveChat you can create eg a bot that can display products as categories and single items. You can store the items in a Google Sheet or in your WooCommerce or Shopify solution.

In this tutorial I´m going to show you how you easily can build a pizza delivery bot with Google Sheets and ActiveChat. Your´re visitors can search for products, add to basket and send order to an email. 

Create a Google Sheet

First we need to create a Google Sheet with all the products.
Create columns for ID, category, name, description, price, image-url and status. ActiveChat then need the column letters to retrieve the data.

Create a bot

Next is to create a new bot in ActiveChat. You can build it from scratch. Remember to integrate with your Google Account under Settings > Integrations. I also enable the visual builder in botbuilder-menu and delete all blocks but start in the start-skill.

Now you ready to roll!

Dynamic Gallery

We´re going to use our sheet to get the values in a gallery in 3 simple steps:

  1. Connect a GS Gallery Block to the start-block and select your spreadsheet in sheet options. 
  2. Search for all active products in column G.
  3. Input column C, D & F for title, subtitle (description) and image. In attributes add price, category and id. As in my example above.

If you use more columns just use the appropriate letters. 

 

Now we can test the bot. It already looks great! It fetches the products dynamically.

 

Add buttons to order pizza

Now we´re going to add buttons to our gallery so our visitors can order some pizza!

In the GS Gallery Block add a button and name it order. Connect the block to a textblock and ask for quantity.

Save this value in a listenblock as $quantity. You can add numbers or let the visitor write a number in the listenblock (quick reply).

Connect the quantity to Addtocart-block and update the variables:

  1. id = $_selected_gallery_id (attribute set in GS Gallery Block)
  2. title = $_selected_gallery_title
  3. quantity = $quantity (from the listenblock)
  4. image url = $_selected_gallery_image
  5. price = $_selected_gallery_price (attribute set in GS Gallery Block)

The cart is updated and you can verify this with a textblock to the visitor:

Cart updated with $quantity items of $_selected_gallery_title.

Total: $_cart_total_sum

Learn more about system variables for Google Sheets Gallery in this document

End for now with a Showcart block and buttons to “Add more” or “Checkout”.

If the visitor wants to add more items, let them start over in the GS Gallery. Oterwise connect it to a lead. See image. 

Send a lead

It´s time to send the order to you! You can use a lot of different alternativs to save this. As use Google Sheet, trigger another messenger-id, send sms with Twilio, integrate with your system  and so on.

We´re here focusing on building a simple orderbot so we will send the order as an email with the lead-block.

Collect name, email and phone. Use Quick-replies buttons for email and phone. Here you can use validation also, but were going to skip that this time. Follow ActiveChats manual to learn more about that.

When user has filled in all data, the email is sent (remember to configure SMTP setting also in Settings > Channels.) Rememer to use Clear Cart block after every order so the cart will be reset.

 

Result

We have now built an basic pizza delivery bot to display pizzas dynamically from a Google Sheet and also made it possible to order one or more items.

Hope this tutorials can help you get started with ActiveChat.

Here you can test the bot

Mer läsning

0 kommentarer

Adress

Joolo Webbdesign
c/o Henrik Rossini
Bäckvägen 88, 818 92 VALBO

Telefon

0730-556145

Öppettider

Enligt överenskommelse