Build an enterprise deal knowledge graph with Salesforce, Gmail and Neo4j
Go to WorkflowDescription
Quick overview
This workflow runs every 6 hours to pull Salesforce contacts, accounts, and opportunities, then fetches related Gmail messages and Google Calendar events, calculates per-contact engagement metrics, and writes a Neo4j knowledge graph with entities and relationships for deal and stakeholder analysis.
How it works
Runs every 6 hours on a schedule.
Fetches Contacts, Accounts, and Opportunities from Salesforce and normalizes them into consistent records.
Builds a Gmail search query from the first 20 unique Salesforce contact email addresses and retrieves matching Gmail messages from the last 30 days, then normalizes the email metadata.
Retrieves Google Calendar events from a 30-day lookback to a 30-day lookahead window and normalizes them into meeting records with attendee details.
Combines the normalized Salesforce, Gmail, and Google Calendar data and builds a relationship profile per contact with engagement metrics and interaction history.
Converts the profiles into a graph payload (Contact, Account, Opportunity, Email, Meeting nodes plus edges like BELONGS_TO, OWNS, INVOLVED_IN, SENT_OR_RECEIVED, and ATTENDED).
Writes the nodes and then the relationships into Neo4j using the Neo4j Query API.
Setup
Add credentials for Salesforce, Gmail, Google Calendar, and Neo4j (HTTP Basic Auth for the Neo4j Query API).
Replace the Neo4j Query API URLs in both Neo4j HTTP requests with your Neo4j AuraDB endpoint and database path.
Review and adjust the lookback/lookahead window and message/event limits in Set Workflow Config to match your data volume.
Ensure your Salesforce data includes populated Contact Email values, since these drive the dynamic Gmail search query.
Additional info
Add-ons
Slack alerts for high-value deals
AI-based stakeholder scoring
CRM enrichment APIs
Real-time webhook triggers instead of scheduler
Dashboard integration (Metabase, Superset, etc.)
Use Case Examples
Identify most engaged contacts across deals
Track full relationship history of an account
Analyze deal pipeline with weighted values
Discover inactive but high-value stakeholders
Visualize communication patterns across teams
There can be many more such use cases depending on how you extend the graph.
Troubleshooting Guide
| Issue | Possible Cause | Solution |
| ---------------------------------- | ------------------------- | ----------------------------------------- |
| No Gmail data | Query not matching emails | Check Build Gmail Query From Contacts |
| No Calendar events | Wrong calendar_id | Verify in Get Calendar Events |
| Empty graph | Payload not generated | Check Build Graph Payload output |
| Nodes created but no relationships | Edge payload missing | Verify Write Relationships To Neo4j |
| Authentication errors | Credentials not set | Reconnect OAuth credentials |
| Duplicate nodes | ID mismatch | Ensure consistent ID format in payload |
Need Help
If you need help setting up, customizing or extending this workflow, feel free to reach out.
We can help you:
Deploy this workflow in production
Customize Neo4j schema and queries
Add AI-driven insights
Build dashboards and reporting layers
Design enterprise-grade automation systems
Contact WeblineIndia to hire n8n developers for professional support and custom workflow development.