Expanding Your Bubble App: Adding Documents through PDF Uploads and Web Page Text Extraction
Last updated
June 30, 2023
Header 1
Header 2
Header 3
Header 4
Header 5
Header 6
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
In the latest tutorial, we delved deeper into expanding our Bubble app's capabilities, focusing on adding documents by uploading PDFs and extracting text from web pages. This process involved incorporating two different API calls. While it may seem complex initially, it becomes significantly simpler with a clear understanding.
Watch the video below and read on to learn more:
Integrating Rapid API for PDF Uploads
The first task was to enable PDF uploads in our Bubble app, for which we needed an API call that could convert the PDF into a readable text format. To achieve this, we turned to Rapid API, an invaluable tool with an extensive list of APIs suitable for all kinds of tasks.
Step 1: Set up a Rapid API Account
The initial step was to sign up on rapidapi.com, a process that can be done for free. After signing in, we found ourselves in the dashboard, a portal to many APIs that can help build diverse applications in Bubble.
Step 2: Choose the Right API
We searched for 'PDF to text converter' in the dashboard, a reliable and popular API with positive ratings and dependable service levels.
Step 3: Initialize and Test the API
Next, we set up the test endpoint using the default application parameters. We used form data for media types and selected a sample PDF for testing, in this case, the Bitcoin whitepaper. After uploading the PDF and initiating the test endpoint, we were rewarded with a successful response containing the text from our uploaded PDF.
Step 4: Finalizing the Setup
The final step involved setting up intricate details like headers, values, and the body type. We demonstrated how to initialize a call, receive a response, and alter the authentication to a private key and header, offering flexibility in terms of user preference.
Integrating Extractor API for Web Page Text Extraction
Following the PDF upload setup, our next task was to extract text from a web page. This requirement led us to the Extractor API, an excellent tool to extract URLs.
Step 1: Get the API Key
After logging into extractorapi.com, we got our API key, a critical component for using the API.
Step 2: Implement the API
We discovered that the Extractor API call was a GET call, implying that all the data we needed was going to be in the URL.
Step 3: Setting Up in Bubble
Within Bubble, we set up the API call (web 2 text), ensuring the data type was JSON. We added the dynamic value in the URL and our API key.
Step 4: Test the API
We tested the setup using a Wikipedia page URL, and the successful response contained all the text from the page.
Concluding Remarks
By the end of the tutorial, we had successfully set up API calls for document addition through PDFs (using Rapid API) and website text extraction (using Extractor API). The search for reliable APIs may seem like a daunting task, but these two APIs have proven their worth. However, it's essential to keep exploring other APIs that may cater better to your specific needs.