When you go to buy a new car, you get to decide which add-ons you want it to have. From an upgraded engine to a state-of-the-art navigation system, the add-ons you choose make your car more powerful, and more useful to you. When it comes to chatbots, the same idea applies. You can build a basic chatbot in three minutes. But to make it more powerful, you'll want to incorporate some add-ons. While there are many no-code add-ons available for your Chatfuel bot (like artificial intelligence and Zapier integrations), there are developer solutions too. Easily the most popular of these is the JSON API for your (or your client's) chatbot.
What is the JSON API?
What is the JSON API? Data in the JSON format is passed from place to place via a fetching tool called an API. So the JSON API lets you fetch dynamic data from another server for use in your bot.
Imagine an API kind of like a phone line—a way for two separate entities to directly communicate. Your bot picks up the phone, calls whatever server it needs data from, and asks for it. The server answers, and gives the bot the data they need in the JSON format.
In Chatfuel, the API for JSON takes the form of a plugin. Here's a simple breakdown of how the free JSON API plugin works in a bot flow:
- A user is chatting with your bot.
- The user gets to the point in the flow where you've placed the JSON API plugin.
- This plugin triggers your bot to use the API to "call" the external server you specified when you set up the plugin, so it can receive the data it needs (in the JSON format).
- The bot brings that JSON-formatted data back to Chatfuel.
- Chatfuel renders the data for the Messenger interface so the user can see or use it for some practical application in the flow.
Though it sounds like it would be time consuming, all five of these steps happen more or less instantly. 🏎️ Note that coding knowledge is required to use the JSON API.
Why use the JSON API in your bot?
Simply put: because it allows you to build better bots. Let's say, for instance, that you have a Facebook chatbot that tells users the current price of 100 different stocks. Without the JSON API, this functionality would be all but impossible to set up. You'd have to create 100 different blocks in your bot, one for each stock. Next, you'd have to look up and then manually enter the price for each. When any stock changes, even by a dollar, you'd have to manually change the price in your bot. Since stock prices fluctuate constantly, your chatbot would essentially always be outdated.
But with the JSON API, your bot could fetch information from a server that has up-to-date stock prices at all times. That way, any time a user asks your bot for the price of a certain stock, they'll be getting fresh data on the spot.
So the JSON API lets you create Messenger bots that:
- Save you time 🧠 It allows them to do even more on autopilot, and with less manual work from you.
- Are more useful to users 🙋🏽They can provide more, relevant information to users than a chatbot that can only deal in static data.
- Provide a more personalized experience 📍A common use for the JSON API is to fetch the current day or time in a certain time zone (like the user's). That means it's possible to personalize any user's chatbot experience even more, making it extra relevant and memorable.
To put JSON in even more concrete terms, let's look at its key use cases for Facebook Messenger bots.
Top use cases for the JSON API
So you're building a Messenger bot for your business, or for a client's business. If you want to equip it to do any of the following tasks, use the JSON API. Let's say you want to:
- Integrate your ecommerce store with your bot. If your store is hosted on Shopify, here's how to integrate it with your Chatfuel bot. If your store is hosted on another platform (like WooCommerce, Wix, Magento, BigCommerce, etc.), use the JSON API to integrate it with your bot. That way, your chatbot will always be able to display the most up-to-date information for users, from product availability to pricing.
Once you integrate your ecommerce store with your Chatfuel bot, you can do things like:
- Display your store's real-time inventory. Using a product-recommendation chatbot for your ecommerce store? Imagine the user's frustration if they went to your site to buy the suggested item, and found it was out of stock. A prime JSON API example would be to use the API plugin to link directly to your inventory database. That way, the bot won't even show items that aren't actually available.
- Show up-to-date product images. If you have a large inventory of products, manually uploading all the different photos for each to your bot would be seriously time-consuming. But, as another JSON API example, you could link your Facebook bot to your photo database. That way, any time a user asks to view a certain product, the chatbot will show the latest photos from the database. This use case works great for displaying user-generated content that's constantly changing and being updated, too.
- Enforce a limited-time offer. Imagine you're running a short-term sale for your store. The JSON API can track the time so your bot will stop offering the promotion once it has expired. You won't have to manually delete those blocks in the bot when time is up, but customers won't be able to redeem offers when they're no longer valid.
Sales and marketing 👔
- Add bot user information to your CRM or EMS. Messenger chatbots make excellent tools for lead generation. So another answer to the question what is JSON used for? would be: sending that lead information directly to your third-party database. If you're gathering email addresses, you can use the JSON API to send them right to your email marketing solution. If you're gathering complete lead information for future follow up, you can use the JSON API to send those details right to your CRM.
- Display new content from your site in your bot. Want users to be able to view the most recent posts from your blog? Need to make the latest news articles available for them to browse? Add the JSON API to your chatbot so it can instantly fetch new content from your site and display it for users. Set up a Wordpress JSON API if your content is hosted there, for example.
- Let users schedule appointments. You can use the JSON API to fetch information about your availability, so users can only book times that fall within your parameters. For example, you can set your available hours and days, make a mandatory buffer so appointments can't be scheduled at short notice, and more. Then, of course, you can also use the API to link to your calendar so the user can actually schedule the appointment.
Other use cases 💭
- Share score updates for live sporting events. The Golden State Warriors, a Chatfuel client, did this for their fan chatbot. As a prime JSON API example, their bot fetches real-time scores for games in progress. That means users can view the most up-to-date news about the game at any time via Facebook Messenger chatbot.
- Display up-to-date stats for coronavirus infections. Messenger bots have been used for this purpose since the COVID-19 pandemic began. They can connect to real-time information sources using the JSON API to display current infection rates for different cities or countries. 😷Access our free resources and programs to help see your business through the pandemic.
- Offer current weather information. Weather, API, JSON: three words on this topic that commonly go together. If you want your Facebook bot to give up-to-date information about current weather and the latest forecasts, you can use a free weather API for JSON. Use the plugin in Chatfuel to link your bot to a weather database, so it can always return the most recent information to users.
How to set up the JSON API in your chatbot
Wondering how to use an API for JSON in Chatfuel? The instructions for setting up the JSON API in your Messenger chatbot vary widely based on what you'll be using it for. (Remember, this is a developer plugin that requires coding knowledge.) To get started, we recommend visiting our help documentation, watching the webinar below, or asking for advice in the Chatfuel Community.
Use the JSON API to take your chatbot to the next level 🔥
Marketing automation takes on a new meaning when the JSON API is involved. This Chatfuel plugin gives developers the power to connect chatbots to outside data sources, making for a more useful and automated experience for both the business and its bot users.
It's time to start building a bot for your business! Sign up for your free Chatfuel account to get started with our no-code platform. When you're ready to access unlimited users, priority support, and other perks, upgrade to Pro. Running a marketing agency? One of the functions of Chatfuel's Premium Agency plan is to give your team everything it needs to impress clients and grow. Book a demo with us to learn more.