Custom GPT with AI actions chatbot tutorial — Creating an AI Chatbot to interact with 6000+ tools using Zapier and Langchain

Anil Chandra Naidu Matcha
5 min readDec 5, 2023

--

Introduction

In this fast-paced world, Automation in business is essential for enhancing efficiency and reducing the time and resources spent on repetitive, manual tasks. From OpenAI dev day, you must have heard about how GPTs are revolutionising the world and Zapier’s integration with GPT to allow creating Custom GPTs with 6000+ tools.

But what if you would want to add this functionality to your website and share with users. EmbedAI integration with Zapier allows you to create a chatbot to connect with 6000+ tools powered by Zapier and Langchain. Once you create a chatbot, you can embed it on your website and share with your users without the restriction of needing a ChatGPT plus account or the limitation of 25 messages for GPT4. In addition you can gate the chatbot and monetize your chatbot

Let’s explore how we can achieve this.

What is EmbedAI ?

EmbedAI is a platform that enables users to create AI chatbots powered by ChatGPT using their data.

Key features of EmbedAI:

1. Knowledge Base Creation: With EmbedAI, each user account can create and manage a knowledge base that’s trained on their webpage, allowing you to design your very own AI model. This means that your AI chatbot will be tailored to your specific needs and preferences.

2. Multiple data sources: EmbedAI supports taking data from multiple sources including webpages, pdf, docs, Youtube videos, Notion documents etc.

3. Nocode Integrations: EmbedAI integrates with Zapier to connect with 6000+ apps and has integrations with other live chat platforms like Intercom, Crisp etc.

4. Live chat support: EmbedAI supports live chat support in addition to AI chatbot so that you can have a human agent take over from AI anytime

5. Multilingual Capabilities: EmbedAI’s chatbot service operates in over 100 languages, ensuring that you can reach and engage with a global audience. This feature enables you to break down language barriers and connect with users worldwide.

EmbedAI x Zapier Integration Functionality

Some of the major use-cases you can achieve with EmbedAI by connecting with Zapier to enhance the user experience:

a. Shopify Product Recommender: Use Shopify APIs to retrieve product data and suggest relevant products based on customer preferences and browsing history.

b. Gmail Assistant: Read emails and respond to any email directly from the chatbot.

d. Slack Messaging Chatbot: Send messages to any slack channel directly from the chatbot.

e. Calendar Assistant: View your calendar events or set a new calendar event directly from the chatbot.

Zapier Integration steps

To integrate EmbedAI with Zapier, sign up to EmbedAI from here https://embedai.thesamur.ai/ and follow the below steps. Here are the steps

1. Click on Integrations and select Zapier

2. Follow the links and generate Zapier api key and paste in the input box

3. Create relevant Zapier AI actions by connecting your Shopify, Gmail, Slack, Calendar or any of the 6000+ apps

4. Click on “New Chatbot” and select Zapier chatbot

5. Now start interacting with your chatbot to chat with any of the 6000+ tools

Here is a demo video to setup the entire flow of integrating EmbedAI with Zapier

Langchain OpenAPI agent to connect with Zapier

LangChain is a powerful AI framework that plays a crucial role in the development of applications powered by large language models (LLMs). Langchain makes it easier for developers to build advanced applications such as chatbots, document analysis, summarization, and code analysis

To interact with APIs using LangChain involves function calling with get_openapi_chain. This involves sharing the spec of an api in Openapi standard. Many APIs are already compatible with OpenAI function calling

The Chatbot reads the openapi spec file of Zapier, and based on the user’s question it decides which endpoint needs to use it to get data from the app backend to analyse the data and give the user a perfect answer. Below is the code to generate spec from Zapier. Replace the key with the Zapier api key you obtained from above steps

Now we can invoke the openapi chain with the Zapier obtained and let it interact with any of the enabled actions in the Zapier dashboard. Here is the sample code to create an OpenAPI chain to invoke Zapier api using Langchain and connect with 6000+ tools

Now the output generated is in json format containing a lot of unwanted data. We want to format it and display only the relevant info to the user. We can do this with the help of an additional step by passing the json response to a LLM chain. Below is the code to achieve it

Common Issues

When running openapi chain, one of the major issues you might observe is the following error “AttributeError: ‘super’ object has no attribute ‘parse_obj’ when using OpenAPISpec.from_file”. This usually occurs due to a mismatch with langchain and pydantic version as outlined here https://github.com/langchain-ai/langchain/issues/9520 . Make sure you are using the proper versions before testing

For interaction with any api using langchain, we have two possible solutions. The two being openapi chain(as discussed above) and openapi agent. Using openapi chain can sometimes not provide accurate results compared to openapi agent. But openapi agent can sometimes get stuck in loops leading to higher response times as well as higher api costs. This is a tradeoff one has to make. We went with openapi chain as response time is a major factor in a chat application

When making a query to a tool, sometimes it might invoke a different tool than expected. To overcome this try including the tool name in your query such as “Tell me about product x from Shopify”.

If an AI action is not enabled in Zapier dashboard, you won’t be able to interact with the corresponding tool and thus you would get a response indicating failure. So make sure you add all the relevant actions as per your requirement before starting with the testing. Also whenever you add a new AI action, download the latest spec of Zapier from the code shared in one of the above steps to be able to interact with the newly added apps

Conclusion

Creating an AI chatbot for integration with Zapier api to connect with 6000+ tools is a complex but rewarding endeavour. By combining Zapier api with EmbedAI using Langchain, you can provide your customers with an elegant experience by connecting with tools of your choice. Remember that the success of your chatbot depends on continuous improvement and adaptation to evolving customer needs and preferences. With the right tools and dedication, you can develop a chatbot that enhances user satisfaction and boosts your online business.

--

--