Explore
/
Apps
/
Google Cloud Document AI

What do you want to automate with Google Cloud Document AI?

Prompt, edit and deploy AI agents that connect to Google Cloud Document AI and 2,500+ other apps in seconds.

or select an app to connect with Google Cloud Document AI

1
-
24
of
2,500+
apps by most popular

HTTP / Webhook
HTTP / Webhook
Get a unique URL where you can send HTTP or webhook requests
Node
Node
Anything you can do with Node.js, you can do in a Pipedream workflow. This includes using most of npm's 400,000+ packages.
Python
Python
Anything you can do in Python can be done in a Pipedream Workflow. This includes using any of the 350,000+ PyPi packages available in your Python powered workflows.
Pipedream Utils
Pipedream Utils
Utility functions to use within your Pipedream workflows
OpenAI (ChatGPT)
OpenAI (ChatGPT)
OpenAI is an AI research and deployment company with the mission to ensure that artificial general intelligence benefits all of humanity. They are the makers of popular models like ChatGPT, DALL-E, and Whisper.
Premium
Salesforce
Salesforce
Cloud-based customer relationship management (CRM) platform that helps businesses manage sales, marketing, customer support, and other business activities, ultimately aiming to improve customer relationships and streamline operations.
Premium
HubSpot
HubSpot
HubSpot's CRM platform contains the marketing, sales, service, operations, and website-building software you need to grow your business.
Premium
Zoho CRM
Zoho CRM
Zoho CRM is an online Sales CRM software that manages your sales, marketing, and support in one CRM platform.
Premium
Stripe
Stripe
Stripe powers online and in-person payment processing and financial solutions for businesses of all sizes.
Shopify
Shopify
Shopify is a complete commerce platform that lets anyone start, manage, and grow a business. You can use Shopify to build an online store, manage sales, market to customers, and accept payments in digital and physical locations.
Premium
WooCommerce
WooCommerce
WooCommerce is the open-source ecommerce platform for WordPress.
Premium
Snowflake
Snowflake
A data warehouse built for the cloud
Premium
MongoDB
MongoDB
MongoDB is an open source NoSQL database management program.
Supabase
Supabase
Supabase is an open source Firebase alternative.
MySQL
MySQL
MySQL is an open-source relational database management system.
PostgreSQL
PostgreSQL
PostgreSQL is a free and open-source relational database management system emphasizing extensibility and SQL compliance.
Premium
AWS
AWS
Amazon Web Services (AWS) offers reliable, scalable, and inexpensive cloud computing services.
Premium
Twilio SendGrid
Twilio SendGrid
Send marketing and transactional email through the Twilio SendGrid platform with the Email API, proprietary mail transfer agent, and infrastructure for scalable delivery.
Amazon SES
Amazon SES
Amazon SES is a cloud-based email service provider that can integrate into any application for high volume email automation
Premium
Klaviyo
Klaviyo
Email Marketing and SMS Marketing Platform
Premium
Zendesk
Zendesk
Zendesk is award-winning customer service software trusted by 200K+ customers. Make customers happy via text, mobile, phone, email, live chat, social media.
Premium
ServiceNow
ServiceNow
The smarter way to workflow
Notion
Notion
Notion is a new tool that blends your everyday work apps into one. It's the all-in-one workspace for you and your team.
Slack
Slack
Slack is a channel-based messaging platform. With Slack, people can work together more effectively, connect all their software tools and services, and find the information they need to do their best work — all within a secure, enterprise-grade environment.
Build and run workflows using the Google Cloud Document AI API. Use 1000s of source-available triggers and actions across 2,500+ apps. Or write custom code to integrate any app or API in seconds.

Trusted by 1,000,000+ developers from startups to Fortune 500 companies

Adyen logo
Appcues logo
Bandwidth logo
Checkr logo
ChartMogul logo
Dataminr logo
Gopuff logo
Gorgias logo
LinkedIn logo
Logitech logo
Replicated logo
Rudderstack logo
SAS logo
Scale AI logo
Webflow logo
Warner Bros. logo
Adyen logo
Appcues logo
Bandwidth logo
Checkr logo
ChartMogul logo
Dataminr logo
Gopuff logo
Gorgias logo
LinkedIn logo
Logitech logo
Replicated logo
Rudderstack logo
SAS logo
Scale AI logo
Webflow logo
Warner Bros. logo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import { DocumentProcessorServiceClient } from '@google-cloud/documentai/build/src/v1/index.js';
import { promises as fs } from 'fs';
import { get } from 'https';
import { writeFile } from 'fs/promises';
import { join } from 'path';

export default defineComponent({
  props: {
    google_cloud_document_ai: {
      type: "app",
      app: "google_cloud_document_ai",
    }
  },
  async run({ steps, $ }) {
    //Sample pdf file to process by Google Document AI API
    const url = 'https://www.learningcontainer.com/wp-content/uploads/2019/09/sample-pdf-file.pdf';
    const filePath = join('/tmp', 'my_document.pdf');

    const downloadFile = async () => {
      const res = await new Promise((resolve) => get(url, resolve));
      const chunks = [];

      for await (const chunk of res) {
        chunks.push(chunk);
      }

      await writeFile(filePath, Buffer.concat(chunks));
      console.log(`File downloaded successfully to ${filePath}`);
    };

    await downloadFile();

    const projectId = this.google_cloud_document_ai.$auth.project_id;
    const location = this.google_cloud_document_ai.$auth.location;
    const processorId = this.google_cloud_document_ai.$auth.processor_id;

    // Instantiates a client
    // apiEndpoint regions available: eu-documentai.googleapis.com, us-documentai.googleapis.com (Required if using eu based processor)
    // const client = new DocumentProcessorServiceClient({apiEndpoint: 'eu-documentai.googleapis.com'});
    const client = new DocumentProcessorServiceClient();

    async function testRequest() {
      // The full resource name of the processor, e.g.:
      // projects/project-id/locations/location/processor/processor-id
      // You must create new processors in the Cloud Console first
      const name = `projects/${projectId}/locations/${location}/processors/${processorId}`;

      // Read the file into memory.		
      const imageFile = await fs.readFile(filePath);

      // Convert the image data to a Buffer and base64 encode it.
      const encodedImage = Buffer.from(imageFile).toString('base64');

      const request = {
        name,
        rawDocument: {
          content: encodedImage,
          mimeType: 'application/pdf',
        },
      };

      // Recognizes text entities in the PDF document
      const [result] = await client.processDocument(request);
      const { document } = result;

      // Get all of the document text as one big string
      const { text } = document;

      // Extract shards from the text field
      const getText = textAnchor => {
        if (!textAnchor.textSegments || textAnchor.textSegments.length === 0) {
          return '';
        }

        // First shard in document doesn't have startIndex property
        const startIndex = textAnchor.textSegments[0].startIndex || 0;
        const endIndex = textAnchor.textSegments[0].endIndex;

        return text.substring(startIndex, endIndex);
      };

      // Read the text recognition output from the processor
      const [page1] = document.pages;
      const { paragraphs } = page1;
      let concatenatedText = "";
      for (const paragraph of paragraphs) {
        const paragraphText = getText(paragraph.layout.textAnchor);
        concatenatedText += paragraphText;
      }
      return concatenatedText;
    }

    return await testRequest();
  }
})

Authentication

Name Slug: google_cloud_document_ai

Google Cloud Document AI uses API keys for authentication. When you connect your Google Cloud Document AI account, Pipedream securely stores the keys so you can easily authenticate to Google Cloud Document AI APIs in both code and no-code steps.

Important: Make sure you setup the GOOGLE_APPLICATION_CREDENTIALS environment variable in Pipedream, and point it to the path where you save your service account name keys during workflow execution. Note that Pipedream allows users to access files under the /tmp directory, so your GOOGLE_APPLICATION_CREDENTIALS environment variable can point to a file such us /tmp/keys.json, containing your service account with Google Document AI API permissions.

To generate keys for your service account, see Application Default Credentials of on-premises or another cloud provided. You have to make the generated files key available in the path pointed by GOOGLE_APPLICATION_CREDENTIALS when you execute your workflow.

Trusted by 1,000,000+ developers from startups to Fortune 500 companies

Adyen logo
Appcues logo
Bandwidth logo
Checkr logo
ChartMogul logo
Dataminr logo
Gopuff logo
Gorgias logo
LinkedIn logo
Logitech logo
Replicated logo
Rudderstack logo
SAS logo
Scale AI logo
Webflow logo
Warner Bros. logo
Adyen logo
Appcues logo
Bandwidth logo
Checkr logo
ChartMogul logo
Dataminr logo
Gopuff logo
Gorgias logo
LinkedIn logo
Logitech logo
Replicated logo
Rudderstack logo
SAS logo
Scale AI logo
Webflow logo
Warner Bros. logo