How to use Flows with Google Vision API and Google Cloud Functions
Bird
Oct 6, 2020
Flow Builder
1 min read

Key Takeaways
Flows is more than a no-code tool — it’s a flexible automation engine that lets you extend workflows with code using external services like Google Cloud Functions or AWS Lambda.
This tutorial demonstrates how to build a Telegram chatbot that uses Google Vision API to identify images (like detecting if a photo contains a hotdog 🥪).
The example showcases how Flows can easily connect to image recognition APIs to process user-submitted content automatically.
Developers can leverage this architecture to build real-world automation, such as delivery verification, ID checks, or quality control workflows.
Integrating Google Vision API inside a Cloud Function enables AI-powered insights (object detection, label confidence, metadata extraction) that Flows can act upon dynamically.
The “Fetch Variables” step in Flow Builder is the bridge — it calls the cloud function and stores the API response for further use in the conversation.
Reply blocks can use variables like {{isHotDog}} to personalize responses, turning raw data into contextual chat messages.
While the demo is playful, it demonstrates how developers can mix no-code logic with serverless functions to unlock powerful automation capabilities across messaging channels.
Q&A Highlights
What is Flow Builder?
Flow Builder (or Flows) is Bird’s visual automation engine for creating communication workflows across channels — no code required, though it can be extended with custom code.
Why use Google Cloud Functions with Flows?
Cloud Functions allow you to run serverless code to process data (like analyzing images or fetching external API data) and feed the results back into your flow.
What does Google Vision API do in this setup?
It performs image analysis — identifying objects, labels, or concepts (like “hot dog”) — and returns structured data to your Flow.
How do I connect a Cloud Function to Flow Builder?
Use the Fetch Variables step to call the function’s public HTTPS endpoint. The response (e.g.,
{ "isHotDog": true }) can be used in later steps.Can this be used for real business cases?
Absolutely. The same approach can validate delivery photos, detect damaged items, recognize documents, or verify uploaded media.
What makes this integration powerful?
It combines AI vision, serverless flexibility, and multichannel communication, enabling smarter automations without maintaining infrastructure.
Do I need coding experience to follow along?
Basic familiarity with JavaScript (for the Google Cloud Function) helps, but most of the process — from connecting channels to flow logic — is visual and beginner-friendly.
Flows is a powerful drag-and-drop automation engine for creating communication flows. We initially conceived it as a no-code solution, but we found many users could get really powerful behavior writing some code for specific use-cases. These bits of code can be inside Flow Builder, or they can be 3rd party cloud functions like AWS Lambda functions or Google Cloud Functions.
This is a simple demonstration using GoogleCloud Functions and Flows to do image recognition on an image sent on Telegram.
Flows and Beyond
As a developer of Flows I often think who our users are, why they use Flows, and what they need to accomplish their goals; and then, which features we need to implement to best serve those users.
Flows is a powerful drag-and-drop automation engine for creating communication flows. We initially conceived it as a no-code solution, but we found many users could get really powerful behavior writing some code for specific use-cases. For example, you can create flows that automatically generate leads and cases in Salesforce based on customer interactions across multiple channels. These bits of code can be inside Flows, or they can be 3rd party cloud functions like AWS Lambda functions or Google Cloud Functions.
An interesting use case: Image Recognition
For a short and funny example, I will show you how to implement an app that recognizes hot dogs. We will set up a flow in Flows, which will receive images from users and decide, whether they sent a hotdog or not.
For many of our customers, this type of image recognition can be very powerful. Imagine you run a delivery service and you wanted to verify successful deliveries automatically. Similar to what I’m going to show, you could use location data, photos of parcels, and even recipient signatures to create a verification flow in Flows.
A plan for success
Setting up the Google Cloud Function
First, we will need to set up a cloud function. To get started quickly, follow Google’s Cloud Functions quickstart tutorial. As a ‘Trigger’ choose HTTP trigger, execution environment: Node.js 10, and in the source code field insert the code snippet. It’s simple code, which checks whether the request contains JSON code and answers yes or no.

Next, you’ll need to deploy this function. To test it inside Google Cloud Platform, follow steps from the tutorial.
To test from your browser, go to the following URL inserting the specific address for your function:
https://your-function-address.cloudfunctions.net/HotDogOrNot/?url=hello should return {“isHotDog”: true} and the address https://your-function-address.cloudfunctions.net/HotDogOrNot should return {“isHotDog”: false}.
Nice job! You set up a google cloud function. Now we need to make our cloud function smarter.
Setting up the Google Vision API
To make it smarter let’s add image recognition. For this purpose we will use the Google Vision API. To get started, follow steps 1-4 in the Vision API quickstart guide. In the tutorial you’ll activate the Vision API and create a service account to use it.
Now return to the cloud function you created. Toggle “Environment variables, networking, timeouts and more” and in file “Service account” choose the VisionAPI service account you just created. Now we can access the Vision API inside our function.

Now let’s change the code. On a “Package.json” tab, insert this code. It will add Google Vision API library as a dependency to your function.
on "Index.js" tab update existing code with the following code snippet.

What’s the difference compared to the previous version? We added a request to VisionAPI, which returns the ‘labels’ it found on the image. Then we filter these labels by description: if it contains “hot dog” and if it has greater than 60% confidence in that label. If there is at least 1 label remaining after filtering, that means we found a hotdog on the image.
To understand how the Google Vision API works and to view sample responses, check the official Vision API documentation.
After that, deploy the new version of our function. To test it from your browser, find any image of a hotdog and save it's URL. Now go to URL of your function (inserting the correct address for your function) https://your-function-address.cloudfunctions.net/HotDogOrNot?url=url_to_image and replace the “url_to_image” with a URL to the found image. If there is a hotdog in the image, the page will return {“isHotDog”: true}.
Now let’s connect this function to Flow Builder.
Creating a flow in Flows
Log in into the Bird Dashboard or sign up for an account if you don’t have one.
If you are new to Flows and you don’t have any channels set up, you’ll need to go to the Channel setup page, and choose to set up the Telegram channel. I chose Telegram for this demo because it’s easy and fast to set up.

Now you have a channel we can use in Flows. Go to the Flows page, create a new custom flow, and choose the “Telegram” channel trigger.

You’ll be redirected to a flow page, where you should choose your Telegram channel as trigger, in our case it’s “Hotdog”. Please add 2 steps: “Fetch variables” and “Reply to channel message”.
Inside the “Fetch variables” step we will call our cloud function and retrieve response into variable “isHotDog” which will contain “true” or “false” as a response from the GoogleClound function. In URL field please insert URL to your function https://your-function-address.cloudfunctions.net/HotDogOrNot and fill all other fields as on the "Fetch variable step content" picture.
And inside the “Reply to channel message” step we will respond to the customer with a message containing the yes or no response. For that insert in "Reply with message" field the following text "Hotdog on the image? {{isHotDog}}".


If you have any trouble building the flow, you can use the following snippet:

To test it, send an image to your Telegram bot.
So far, it looks cool! We created a small chat bot, which checks images customers sent. To make it prettier, let’s add some more steps as shown below:

If you have any trouble building the flow, you can use the following snippet:
Results


While this is a fun example, we believe this type of functionality can be very useful for our users.
If you want more features like this built-in in Flows, write to our support team to let us know.



