How to use ChatGPT to call an API and create event-driven automated workflows

The power of AI lies not just in the generation of data but in its seamless integration into our existing workflows

Image of Tina Huang
Tina Huang, Founder and CTO
Jun 21st, 2023

Technology like ChatGPT allows anyone to generate API calls effortlessly, giving us specific instructions on how to call an API for practically any tool or service. But these instructions only take us so far — there are still inherent limitations to what ChatGPT can do. We don’t just want to know how to call an API — we want to use that API call to accomplish a specific task and seamlessly incorporate it into a broader workflow.

There are many areas of complexity that surpass the current capabilities of ChatGPT, like authentication, token management, rate limits, error handling, workflow orchestration, data synchronization, security, and permissions. Essentially, ChatGPT can give us the instruction manual, but we're still left with hundreds of nuts and bolts to piece together.

Here’s an example. Say I'm an SRE wanting to build an automated workflow that triggers anytime an incident is created. In this workflow, I want to create a Jira ticket, Slack channel, and Zoom meeting. I can easily ask ChatGPT how to call the API for each of these tasks, for example “How do I call the Jira Software API to create a new issue?”

Instantly ChatGPT gives me a set of instructions. The problem is, I don’t just want to know how to call the Jira Software API — I want to use this API to automatically create a new issue, alongside other automations, when my incident is created.

To do this, I still need to figure out how to securely store and manage the API tokens or keys required to authenticate with the different services, how to chain each of these automations together into a complete workflow, and how to set up event-driven tiggers so it executes when my incident is created. I also want to be able to use and see my automated workflow from where I’m working in Slack, making sure it hits my credentials.

On top of all this, I need to think about how to handle API rate limits, ensure I have error handling in place, enable data synchronization between Jira, Slack, and Zoom, and set up logging and monitoring mechanisms to track the execution of my automation.

Lastly, but just as importantly, I have to be weary of LLM’s tendency to "hallucinate," or generate inaccurate data. How can I verify that the data we’re given is accurate and useful?

To make use of the data generated from ChatGPT, we need the right infrastructure, or plumbing, in place.

How to use ChatGPT in Transposit to Call an API and Create Event-Driven Automated Workflows#

We can think of the Transposit infrastructure as plumbing, with pipes that enable users to use data generated from AI to actually accomplish a given task. Whether it's obtaining an authentication token, utilizing the no-code interface to chain actions together, or incorporating automated actions within Slack, this plumbing enhances the usefulness of AI. This tiny bit of AI plugged into this infrastructure — or plumbing — now becomes incredibly powerful.

Here are some ways Transposit’s plumbing enables users to use ChatGPT and AI to more easily and seamlessly accomplish a task:

Authentication Simplified: Built-in identity and authentication capabilities enable users to obtain authentication tokens seamlessly.

Intuitive No-Code Builder: The no-code builder empowers users to chain multiple automations together, allowing users to incorporate AI-generated API calls into workflows in seconds. This also allows users to modify the AI-generated action and give a final stamp of approval.

Slack Integration: The seamless integration with Slack allows users to trigger automation and access their credentials within a channel.

Event-Driven Automation: Robust event-driven capabilities allow users to trigger automation based on specific events or conditions.

Mapping AI-Generated Action to OpenAPI: Transposit automatically maps the output of AI-generated actions to OpenAPI to verify the output, ensuring that any inaccuracies generated from AI (or “hallucinations”) are corrected.

Error Handling and Logging: Transposit enables teams to create workflows that run when an error occurs, easily notifying a user, rerunning the workflow, or any other task. Transposit also automatically logs every automated action so teams can evaluate their effectiveness.

Let's revisit the Jira example using ChatGPT within Transposit. We can easily ask AI for a new action to create a Jira issue. In seconds, AI has created the action within the no-code builder and provided fields to add the necessary data.

Since our Jira integration is already authenticated within the platform, we only need to focus on adding data to the required fields. Data can be added manually, pulled from previous actions, or obtained through user input. For this example, we’ll add a user input so that anyone running this script can add the issue summary and description.

We can even string together multiple AI-generated actions, such as creating a Slack channel and Zoom meeting, and adding a comment to the Jira issue we just created.

Chaining these actions together allows us to utilize data generated from previous actions. For instance, we can use the IssueKey generated from the "Create issue" action to fill in the required field (issueIdOrKey) for the "Add comment to issue" action. We can also populate required fields with data available within an incident, such as the incident name or description.

We can now add this script to an incident type, automating its execution when an incident is created.

Now, when an incident is created, a Slack channel, Zoom meeting, and Jira issue are all created, and we can see all these automated actions right from Slack.

In the ever-evolving landscape of technology, AI-powered solutions like ChatGPT have revolutionized the way we interact with data and automate tasks. However, the true power of AI lies not just in the generation of data but in its seamless integration into our existing workflows. Transposit's infrastructure serves as the conduit that connects AI-generated data with real-world applications, amplifying its usefulness and enabling users to accomplish their goals more easily and seamlessly.