Table of Contents

OCR in Landbot

Abby Updated by Abby

OCR is a technology that recognizes text within a digital image. It is commonly used to recognize text in scanned documents and images

OCR or optical character recognition is becoming more and more common and can be useful for many different types of use cases, such as uploading a receipt and sending the information to our database

Here's a quick example of OCR in action:

While most OCR API's require form-data (which is unfortunately, not compatible with Landbot), there are a few OCR API's that only need a url where the image is hosted

This makes it extremely easy to integrate with Landbot, as when users upload images a url is returned

In this tutorial we'll show you how to collect an image from the user, send it to the API and return the text contained in the image

We'll be using an API called OCR - Extract Text, this is a freemium product, meaning you'll be able to test it out before paying

Step 0: Add File Input

We first need to get the user image in order to send it to the API, we'll do that by using a simple File Question and saving the variable as @imageurl

Step 1: Create RAPID API Account and Subscribe

A Rapid API account is free and allows you to get an API key and subscribe to various API's

Once you have created your account, go here and subscribe

Step 2: Set Up the Webhook

This will be a GET request with the following endpoint: https://ocr-extract-text.p.rapidapi.com/ocr

In Params, we'll add the key url and the value will be the variable we saved in the file block (imageurl)

Next, we'll add the headers, you'll find them in the API documentation

We'll copy the headers exactly as we see them in the documentation and add them to the webhook

It should look like this:

Step 3: Test the request

Next we'll test the request, with a test url for the value of @imageurl

If we've done everything correctly, this should be the response:

We'll select the purple drop down and save only the Text data in a variable, and that's it!

The builder:

The flow:

How did we do?

Contact