Back to Catalog

Scrape Twitter profiles with Bright Data API and export to Google Sheets

IncrementorsIncrementors
577 views
2/3/2026
Official Page

🐦 Twitter Profile Scraper via Bright Data API with Google Sheets Output

A comprehensive n8n automation that scrapes Twitter profile data using Bright Data's Twitter dataset and stores comprehensive tweet analytics, user metrics, and engagement data directly into Google Sheets.

πŸ“‹ Overview

This workflow provides an automated Twitter data collection solution that extracts profile information and tweet data from specified Twitter accounts within custom date ranges. Perfect for social media analytics, competitor research, brand monitoring, and content strategy analysis.

✨ Key Features

πŸ”— Form-Based Input: Easy-to-use form for Twitter URL and date range selection
🐦 Twitter Integration: Uses Bright Data's Twitter dataset for accurate data extraction
πŸ“Š Comprehensive Data: Captures tweets, engagement metrics, and profile information
πŸ“ˆ Google Sheets Storage: Automatically stores all data in organized spreadsheet format
πŸ”„ Progress Monitoring: Real-time status tracking with automatic retry mechanisms
⚑ Fast & Reliable: Professional scraping with built-in error handling
πŸ“… Date Range Control: Flexible time period selection for targeted data collection
🎯 Customizable Fields: Advanced data field selection and mapping

🎯 What This Workflow Does

Input

  • Twitter Profile URL: Target Twitter account for data scraping
  • Date Range: Start and end dates for tweet collection period
  • Custom Fields: Configurable data points to extract

Processing

  1. Form Trigger: Collects Twitter URL and date range from user input
  2. API Request: Sends scraping request to Bright Data with specified parameters
  3. Progress Monitoring: Continuously checks scraping job status until completion
  4. Data Retrieval: Downloads complete dataset when scraping is finished
  5. Data Processing: Formats and structures extracted information
  6. Sheet Integration: Automatically populates Google Sheets with organized data

Output Data Points

| Field | Description | Example | |-------|-------------|---------| | user_posted | Username who posted the tweet | @elonmusk | | name | Display name of the user | Elon Musk | | description | Tweet content/text | "Exciting updates coming soon..." | | date_posted | When the tweet was posted | 2025-01-15T10:30:00Z | | likes | Number of likes on the tweet | 1,234 | | reposts | Number of retweets | 567 | | replies | Number of replies | 89 | | views | Total view count | 12,345 | | followers | User's follower count | 50M | | following | Users they follow | 123 | | is_verified | Verification status | true/false | | hashtags | Hashtags used in tweet | #AI #Technology | | photos | Image URLs in tweet | image1.jpg, image2.jpg | | videos | Video content URLs | video1.mp4 | | user_id | Unique user identifier | 12345678 | | timestamp | Data extraction timestamp | 2025-01-15T11:00:00Z |

πŸš€ Setup Instructions

Prerequisites

  • n8n instance (self-hosted or cloud)
  • Bright Data account with Twitter dataset access
  • Google account with Sheets access
  • Valid Twitter profile URLs to scrape
  • 10-15 minutes for setup

Step 1: Import the Workflow

  1. Copy the JSON workflow code from the provided file
  2. In n8n: Workflows β†’ + Add workflow β†’ Import from JSON
  3. Paste JSON and click Import

Step 2: Configure Bright Data

  1. Set up Bright Data credentials:
    • In n8n: Credentials β†’ + Add credential β†’ HTTP Header Auth
    • Enter your Bright Data API credentials
    • Test the connection
  2. Configure dataset:
    • Ensure you have access to Twitter dataset (gd_lwxkxvnf1cynvib9co)
    • Verify dataset permissions in Bright Data dashboard

Step 3: Configure Google Sheets Integration

  1. Create a Google Sheet:
    • Go to Google Sheets
    • Create a new spreadsheet named "Twitter Data" or similar
    • Copy the Sheet ID from URL: https://docs.google.com/spreadsheets/d/SHEET_ID_HERE/edit
  2. Set up Google Sheets credentials:
    • In n8n: Credentials β†’ + Add credential β†’ Google Sheets OAuth2 API
    • Complete OAuth setup and test connection
  3. Prepare your data sheet with columns:
    • Use the column headers from the data points table above
    • The workflow will automatically populate these fields

Step 4: Update Workflow Settings

  1. Update Bright Data nodes:
    • Open "πŸš€ Trigger Twitter Scraping" node
    • Replace BRIGHT_DATA_API_KEY with your actual API token
    • Verify dataset ID is correct
  2. Update Google Sheets node:
    • Open "πŸ“Š Store Twitter Data in Google Sheet" node
    • Replace YOUR_GOOGLE_SHEET_ID with your Sheet ID
    • Select your Google Sheets credential
    • Choose the correct sheet/tab name

Step 5: Test & Activate

  1. Add test data:
    • Use the form trigger to input a Twitter profile URL
    • Set a small date range for testing (e.g., last 7 days)
  2. Test the workflow:
    • Submit the form to trigger the workflow
    • Monitor progress in n8n execution logs
    • Verify data appears in Google Sheet
    • Check all expected columns are populated

πŸ“– Usage Guide

Running the Workflow

  1. Access the workflow form trigger URL (available when workflow is active)
  2. Enter the Twitter profile URL you want to scrape
  3. Set the start and end dates for tweet collection
  4. Submit the form to initiate scraping
  5. Monitor progress - the workflow will automatically check status every minute
  6. Once complete, data will appear in your Google Sheet

Understanding the Data

Your Google Sheet will show:

  • Real-time tweet data for the specified date range
  • User engagement metrics (likes, replies, retweets, views)
  • Profile information (followers, following, verification status)
  • Content details (hashtags, media URLs, quoted tweets)
  • Timestamps for each tweet and data extraction

Customizing Date Ranges

  • Recent data: Use last 7-30 days for current activity analysis
  • Historical analysis: Select specific months or quarters for trend analysis
  • Event tracking: Focus on specific date ranges around events or campaigns
  • Comparative studies: Use consistent time periods across different profiles

πŸ”§ Customization Options

Modifying Data Fields

Edit the custom_output_fields array in the "πŸš€ Trigger Twitter Scraping" node to add or remove data points:

"custom_output_fields": [
  "id", "user_posted", "name", "description", 
  "date_posted", "likes", "reposts", "replies",
  "views", "hashtags", "followers", "is_verified"
]

Changing Google Sheet Structure

Modify the column mapping in the "πŸ“Š Store Twitter Data in Google Sheet" node to match your preferred sheet layout and add custom formulas or calculations.

Adding Multiple Recipients

To process multiple Twitter profiles:

  1. Modify the form to accept multiple URLs
  2. Add a loop node to process each URL separately
  3. Implement delays between requests to respect rate limits

🚨 Troubleshooting

Common Issues & Solutions

  1. "Bright Data connection failed"

    • Cause: Invalid API credentials or dataset access
    • Solution: Verify credentials in Bright Data dashboard, check dataset permissions
  2. "No data extracted"

    • Cause: Invalid Twitter URLs or private/protected accounts
    • Solution: Verify URLs are valid public Twitter profiles, test with different accounts
  3. "Google Sheets permission denied"

    • Cause: Incorrect credentials or sheet permissions
    • Solution: Re-authenticate Google Sheets, check sheet sharing settings
  4. "Workflow timeout"

    • Cause: Large date ranges or high-volume accounts
    • Solution: Use smaller date ranges, implement pagination for high-volume accounts
  5. "Progress monitoring stuck"

    • Cause: Scraping job failed or API issues
    • Solution: Check Bright Data dashboard for job status, restart workflow if needed

Advanced Troubleshooting

  • Check execution logs in n8n for detailed error messages
  • Test individual nodes by running them separately
  • Verify data formats and ensure consistent field mapping
  • Monitor rate limits if scraping multiple profiles consecutively
  • Add error handling and implement retry logic for robust operation

πŸ“Š Use Cases & Examples

1. Social Media Analytics

Goal: Track engagement metrics and content performance

  • Monitor tweet engagement rates over time
  • Analyze hashtag effectiveness and reach
  • Track follower growth and audience interaction
  • Generate weekly/monthly performance reports

2. Competitor Research

Goal: Monitor competitor social media activity

  • Track competitor posting frequency and timing
  • Analyze competitor content themes and strategies
  • Monitor competitor engagement and audience response
  • Identify trending topics and hashtags in your industry

3. Brand Monitoring

Goal: Track brand mentions and sentiment analysis

  • Monitor specific Twitter accounts for brand mentions
  • Track hashtag campaigns and user-generated content
  • Analyze sentiment trends and audience feedback
  • Identify influencers and brand advocates

4. Content Strategy Development

Goal: Analyze successful content patterns

  • Identify high-performing tweet formats and topics
  • Track optimal posting times and frequencies
  • Analyze hashtag performance and reach
  • Study audience engagement patterns

5. Market Research

Goal: Collect social media data for market analysis

  • Gather consumer opinions and feedback
  • Track industry trends and discussions
  • Monitor product launches and market reactions
  • Support product development with social insights

βš™ Advanced Configuration

Batch Processing Multiple Profiles

To monitor multiple Twitter accounts efficiently:

  1. Create a master sheet with profile URLs and date ranges
  2. Add a loop node to process each profile separately
  3. Implement delays between requests to respect rate limits
  4. Use separate sheets or tabs for different profiles

Adding Data Analysis

Enhance the workflow with analytical capabilities:

  1. Create additional sheets for processed data and insights
  2. Add formulas to calculate engagement rates and trends
  3. Implement data visualization with charts and graphs
  4. Generate automated reports and summaries

Integration with Business Tools

Connect the workflow to your existing systems:

  • CRM Integration: Update customer records with social media data
  • Slack Notifications: Send alerts when data collection is complete
  • Database Storage: Store data in PostgreSQL/MySQL for advanced analysis
  • BI Tools: Connect to Tableau/Power BI for comprehensive visualization

πŸ“ˆ Performance & Limits

Expected Performance

  • Single profile: 30 seconds to 5 minutes (depending on date range)
  • Data accuracy: 95%+ for public Twitter profiles
  • Success rate: 90%+ for accessible accounts
  • Daily capacity: 10-50 profiles (depends on rate limits and data volume)

Resource Usage

  • Memory: ~200MB per execution
  • Storage: Minimal (data stored in Google Sheets)
  • API calls: 1 Bright Data call + multiple Google Sheets calls per profile
  • Bandwidth: ~5-10MB per profile scraped
  • Execution time: 2-10 minutes for typical date ranges

Scaling Considerations

  • Rate limiting: Add delays for high-volume scraping
  • Error handling: Implement retry logic for failed requests
  • Data validation: Add checks for malformed or missing data
  • Monitoring: Track success/failure rates over time
  • Cost optimization: Monitor API usage to control costs

🀝 Support & Community

Getting Help

  • n8n Community Forum: community.n8n.io
  • Documentation: docs.n8n.io
  • Bright Data Support: Contact through your dashboard
  • GitHub Issues: Report bugs and feature requests

Contributing

  • Share improvements with the community
  • Report issues and suggest enhancements
  • Create variations for specific use cases
  • Document best practices and lessons learned

πŸ“‹ Quick Setup Checklist

Before You Start

☐ n8n instance running (self-hosted or cloud)
☐ Bright Data account with Twitter dataset access
☐ Google account with Sheets access
☐ Valid Twitter profile URLs ready for scraping
☐ 10-15 minutes available for setup

Setup Steps

☐ Import Workflow - Copy JSON and import to n8n
☐ Configure Bright Data - Set up API credentials and test
☐ Create Google Sheet - New sheet with proper column structure
☐ Set up Google Sheets credentials - OAuth setup and test
☐ Update workflow settings - Replace API keys and sheet IDs
☐ Test with sample data - Add 1 Twitter URL and small date range
☐ Verify data flow - Check data appears in Google Sheet correctly
☐ Activate workflow - Enable form trigger for production use

Ready to Use! πŸŽ‰

Your workflow URL: Access form trigger when workflow is active

🎯 Happy Twitter Scraping! This workflow provides a solid foundation for automated Twitter data collection. Customize it to fit your specific social media analytics and research needs.

For any questions or support, please contact:
info@incrementors.com
or fill out this form: https://www.incrementors.com/contact-us/

Scrape Twitter Profiles with Bright Data API and Export to Google Sheets

This n8n workflow automates the process of scraping Twitter profile data using the Bright Data API and then exporting the collected information into a Google Sheet. It's designed to be triggered manually via an n8n form, allowing you to initiate the scraping process with specific inputs.

What it does

  1. Triggers on Form Submission: The workflow starts when an n8n form is submitted. This form is expected to provide the necessary input for the Bright Data API.
  2. Makes an HTTP Request to Bright Data API: It sends an HTTP POST request to the Bright Data API endpoint to initiate the Twitter profile scraping job.
  3. Waits for API Response: After the initial request, the workflow pauses, waiting for a short duration to allow the Bright Data API to process the request.
  4. Checks API Status: It then makes another HTTP GET request to check the status of the Bright Data job.
  5. Conditional Processing: An 'If' node checks if the Bright Data job was successful.
    • If successful: The workflow proceeds to retrieve the scraped data.
    • If unsuccessful: The workflow stops, indicating a failure in the scraping process.
  6. Retrieves Scraped Data: If the job was successful, it fetches the actual scraped Twitter profile data from the Bright Data API.
  7. Appends Data to Google Sheets: Finally, it takes the retrieved Twitter profile data and appends it as new rows to a specified Google Sheet.

Prerequisites/Requirements

  • n8n Instance: A running n8n instance to import and execute the workflow.
  • Bright Data Account: An active Bright Data account with access to their Twitter Scraper API. You will need your API credentials (e.g., API key, Zone ID).
  • Google Account: A Google account with access to Google Sheets.
  • Google Sheets Credential in n8n: A Google Sheets OAuth2 or Service Account credential configured in your n8n instance.
  • HTTP Request Credential in n8n: An HTTP Request credential (likely API Key or Basic Auth) configured for Bright Data in your n8n instance.

Setup/Usage

  1. Import the Workflow: Download the provided JSON and import it into your n8n instance.
  2. Configure Credentials:
    • Google Sheets: Configure your Google Sheets credential in the 'Google Sheets' node. You will need to select the appropriate Google Sheet and specify the sheet name where data should be appended.
    • HTTP Request (Bright Data): Configure your Bright Data API credentials in both 'HTTP Request' nodes. This typically involves setting up an API Key or Basic Auth credential and providing the necessary API endpoint URLs and request bodies for initiating and checking job status.
  3. Configure the Form Trigger: The "On form submission" node will generate a webhook URL. You can use this URL to manually trigger the workflow by sending a POST request with the required data (e.g., Twitter profile URLs or search queries for Bright Data).
  4. Activate the Workflow: Once configured, activate the workflow.
  5. Run the Workflow: Submit the n8n form (or send a POST request to its webhook URL) with the desired input for Bright Data. The workflow will then execute, scrape the data, and populate your Google Sheet.

Related Templates

Track competitor SEO keywords with Decodo + GPT-4.1-mini + Google Sheets

This workflow automates competitor keyword research using OpenAI LLM and Decodo for intelligent web scraping. Who this is for SEO specialists, content strategists, and growth marketers who want to automate keyword research and competitive intelligence. Marketing analysts managing multiple clients or websites who need consistent SEO tracking without manual data pulls. Agencies or automation engineers using Google Sheets as an SEO data dashboard for keyword monitoring and reporting. What problem this workflow solves Tracking competitor keywords manually is slow and inconsistent. Most SEO tools provide limited API access or lack contextual keyword analysis. This workflow solves that by: Automatically scraping any competitor’s webpage with Decodo. Using OpenAI GPT-4.1-mini to interpret keyword intent, density, and semantic focus. Storing structured keyword insights directly in Google Sheets for ongoing tracking and trend analysis. What this workflow does Trigger β€” Manually start the workflow or schedule it to run periodically. Input Setup β€” Define the website URL and target country (e.g., https://dev.to, france). Data Scraping (Decodo) β€” Fetch competitor web content and metadata. Keyword Analysis (OpenAI GPT-4.1-mini) Extract primary and secondary keywords. Identify focus topics and semantic entities. Generate a keyword density summary and SEO strength score. Recommend optimization and internal linking opportunities. Data Structuring β€” Clean and convert GPT output into JSON format. Data Storage (Google Sheets) β€” Append structured keyword data to a Google Sheet for long-term tracking. Setup Prerequisites If you are new to Decode, please signup on this link visit.decodo.com n8n account with workflow editor access Decodo API credentials OpenAI API key Google Sheets account connected via OAuth2 Make sure to install the Decodo Community node. Create a Google Sheet Add columns for: primarykeywords, seostrengthscore, keyworddensity_summary, etc. Share with your n8n Google account. Connect Credentials Add credentials for: Decodo API credentials - You need to register, login and obtain the Basic Authentication Token via Decodo Dashboard OpenAI API (for GPT-4o-mini) Google Sheets OAuth2 Configure Input Fields Edit the β€œSet Input Fields” node to set your target site and region. Run the Workflow Click Execute Workflow in n8n. View structured results in your connected Google Sheet. How to customize this workflow Track Multiple Competitors β†’ Use a Google Sheet or CSV list of URLs; loop through them using the Split In Batches node. Add Language Detection β†’ Add a Gemini or GPT node before keyword analysis to detect content language and adjust prompts. Enhance the SEO Report β†’ Expand the GPT prompt to include backlink insights, metadata optimization, or readability checks. Integrate Visualization β†’ Connect your Google Sheet to Looker Studio for SEO performance dashboards. Schedule Auto-Runs β†’ Use the Cron Node to run weekly or monthly for competitor keyword refreshes. Summary This workflow automates competitor keyword research using: Decodo for intelligent web scraping OpenAI GPT-4.1-mini for keyword and SEO analysis Google Sheets for live tracking and reporting It’s a complete AI-powered SEO intelligence pipeline ideal for teams that want actionable insights on keyword gaps, optimization opportunities, and content focus trends, without relying on expensive SEO SaaS tools.

Ranjan DailataBy Ranjan Dailata
161

Generate song lyrics and music from text prompts using OpenAI and Fal.ai Minimax

Spark your creativity instantly in any chatβ€”turn a simple prompt like "heartbreak ballad" into original, full-length lyrics and a professional AI-generated music track, all without leaving your conversation. πŸ“‹ What This Template Does This chat-triggered workflow harnesses AI to generate detailed, genre-matched song lyrics (at least 600 characters) from user messages, then queues them for music synthesis via Fal.ai's minimax-music model. It polls asynchronously until the track is ready, delivering lyrics and audio URL back in chat. Crafts original, structured lyrics with verses, choruses, and bridges using OpenAI Submits to Fal.ai for melody, instrumentation, and vocals aligned to the style Handles long-running generations with smart looping and status checks Returns complete song package (lyrics + audio link) for seamless sharing πŸ”§ Prerequisites n8n account (self-hosted or cloud with chat integration enabled) OpenAI account with API access for GPT models Fal.ai account for AI music generation πŸ”‘ Required Credentials OpenAI API Setup Go to platform.openai.com β†’ API keys (sidebar) Click "Create new secret key" β†’ Name it (e.g., "n8n Songwriter") Copy the key and add to n8n as "OpenAI API" credential type Test by sending a simple chat completion request Fal.ai HTTP Header Auth Setup Sign up at fal.ai β†’ Dashboard β†’ API Keys Generate a new API key β†’ Copy it In n8n, create "HTTP Header Auth" credential: Name="Fal.ai", Header Name="Authorization", Header Value="Key [Your API Key]" Test with a simple GET to their queue endpoint (e.g., /status) βš™οΈ Configuration Steps Import the workflow JSON into your n8n instance Assign OpenAI API credentials to the "OpenAI Chat Model" node Assign Fal.ai HTTP Header Auth to the "Generate Music Track", "Check Generation Status", and "Fetch Final Result" nodes Activate the workflowβ€”chat trigger will appear in your n8n chat interface Test by messaging: "Create an upbeat pop song about road trips" 🎯 Use Cases Content Creators: YouTubers generating custom jingles for videos on the fly, streamlining production from idea to audio export Educators: Music teachers using chat prompts to create era-specific folk tunes for classroom discussions, fostering interactive learning Gift Personalization: Friends crafting anniversary R&B tracks from shared memories via quick chats, delivering emotional audio surprises Artist Brainstorming: Songwriters prototyping hip-hop beats in real-time during sessions, accelerating collaboration and iteration ⚠️ Troubleshooting Invalid JSON from AI Agent: Ensure the system prompt stresses valid JSON; test the agent standalone with a sample query Music Generation Fails (401/403): Verify Fal.ai API key has minimax-music access; check usage quotas in dashboard Status Polling Loops Indefinitely: Bump wait time to 45-60s for complex tracks; inspect fal.ai queue logs for bottlenecks Lyrics Under 600 Characters: Tweak agent prompt to enforce fuller structures like [V1][C][V2][B][C]; verify output length in executions

Daniel NkenchoBy Daniel Nkencho
601

Automate invoice processing with OCR, GPT-4 & Salesforce opportunity creation

PDF Invoice Extractor (AI) End-to-end pipeline: Watch Drive ➜ Download PDF ➜ OCR text ➜ AI normalize to JSON ➜ Upsert Buyer (Account) ➜ Create Opportunity ➜ Map Products ➜ Create OLI via Composite API ➜ Archive to OneDrive. --- Node by node (what it does & key setup) 1) Google Drive Trigger Purpose: Fire when a new file appears in a specific Google Drive folder. Key settings: Event: fileCreated Folder ID: google drive folder id Polling: everyMinute Creds: googleDriveOAuth2Api Output: Metadata { id, name, ... } for the new file. --- 2) Download File From Google Purpose: Get the file binary for processing and archiving. Key settings: Operation: download File ID: ={{ $json.id }} Creds: googleDriveOAuth2Api Output: Binary (default key: data) and original metadata. --- 3) Extract from File Purpose: Extract text from PDF (OCR as needed) for AI parsing. Key settings: Operation: pdf OCR: enable for scanned PDFs (in options) Output: JSON with OCR text at {{ $json.text }}. --- 4) Message a model (AI JSON Extractor) Purpose: Convert OCR text into strict normalized JSON array (invoice schema). Key settings: Node: @n8n/n8n-nodes-langchain.openAi Model: gpt-4.1 (or gpt-4.1-mini) Message role: system (the strict prompt; references {{ $json.text }}) jsonOutput: true Creds: openAiApi Output (per item): $.message.content β†’ the parsed JSON (ensure it’s an array). --- 5) Create or update an account (Salesforce) Purpose: Upsert Buyer as Account using an external ID. Key settings: Resource: account Operation: upsert External Id Field: taxid_c External Id Value: ={{ $json.message.content.buyer.tax_id }} Name: ={{ $json.message.content.buyer.name }} Creds: salesforceOAuth2Api Output: Account record (captures Id) for downstream Opportunity. --- 6) Create an opportunity (Salesforce) Purpose: Create Opportunity linked to the Buyer (Account). Key settings: Resource: opportunity Name: ={{ $('Message a model').item.json.message.content.invoice.code }} Close Date: ={{ $('Message a model').item.json.message.content.invoice.issue_date }} Stage: Closed Won Amount: ={{ $('Message a model').item.json.message.content.summary.grand_total }} AccountId: ={{ $json.id }} (from Upsert Account output) Creds: salesforceOAuth2Api Output: Opportunity Id for OLI creation. --- 7) Build SOQL (Code / JS) Purpose: Collect unique product codes from AI JSON and build a SOQL query for PricebookEntry by Pricebook2Id. Key settings: pricebook2Id (hardcoded in script): e.g., 01sxxxxxxxxxxxxxxx Source lines: $('Message a model').first().json.message.content.products Output: { soql, codes } --- 8) Query PricebookEntries (Salesforce) Purpose: Fetch PricebookEntry.Id for each Product2.ProductCode. Key settings: Resource: search Query: ={{ $json.soql }} Creds: salesforceOAuth2Api Output: Items with Id, Product2.ProductCode (used for mapping). --- 9) Code in JavaScript (Build OLI payloads) Purpose: Join lines with PBE results and Opportunity Id ➜ build OpportunityLineItem payloads. Inputs: OpportunityId: ={{ $('Create an opportunity').first().json.id }} Lines: ={{ $('Message a model').first().json.message.content.products }} PBE rows: from previous node items Output: { body: { allOrNone:false, records:[{ OpportunityLineItem... }] } } Notes: Converts discount_total ➜ per-unit if needed (currently commented for standard pricing). Throws on missing PBE mapping or empty lines. --- 10) Create Opportunity Line Items (HTTP Request) Purpose: Bulk create OLIs via Salesforce Composite API. Key settings: Method: POST URL: https://<your-instance>.my.salesforce.com/services/data/v65.0/composite/sobjects Auth: salesforceOAuth2Api (predefined credential) Body (JSON): ={{ $json.body }} Output: Composite API results (per-record statuses). --- 11) Update File to One Drive Purpose: Archive the original PDF in OneDrive. Key settings: Operation: upload File Name: ={{ $json.name }} Parent Folder ID: onedrive folder id Binary Data: true (from the Download node) Creds: microsoftOneDriveOAuth2Api Output: Uploaded file metadata. --- Data flow (wiring) Google Drive Trigger β†’ Download File From Google Download File From Google β†’ Extract from File β†’ Update File to One Drive Extract from File β†’ Message a model Message a model β†’ Create or update an account Create or update an account β†’ Create an opportunity Create an opportunity β†’ Build SOQL Build SOQL β†’ Query PricebookEntries Query PricebookEntries β†’ Code in JavaScript Code in JavaScript β†’ Create Opportunity Line Items --- Quick setup checklist πŸ” Credentials: Connect Google Drive, OneDrive, Salesforce, OpenAI. πŸ“‚ IDs: Drive Folder ID (watch) OneDrive Parent Folder ID (archive) Salesforce Pricebook2Id (in the JS SOQL builder) 🧠 AI Prompt: Use the strict system prompt; jsonOutput = true. 🧾 Field mappings: Buyer tax id/name β†’ Account upsert fields Invoice code/date/amount β†’ Opportunity fields Product name must equal your Product2.ProductCode in SF. βœ… Test: Drop a sample PDF β†’ verify: AI returns array JSON only Account/Opportunity created OLI records created PDF archived to OneDrive --- Notes & best practices If PDFs are scans, enable OCR in Extract from File. If AI returns non-JSON, keep β€œReturn only a JSON array” as the last line of the prompt and keep jsonOutput enabled. Consider adding validation on parsing.warnings to gate Salesforce writes. For discounts/taxes in OLI: Standard OLI fields don’t support per-line discount amounts directly; model them in UnitPrice or custom fields. Replace the Composite API URL with your org’s domain or use the Salesforce node’s Bulk Upsert for simplicity.

Le NguyenBy Le Nguyen
942