Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions Personal_Notebook/03_Pipedrive_AI_Enrichment/Case_Study_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Automating Sales Research with AI (My Experience)

Hi everyone! 👋

So, I want to share this really cool project I worked on recently. It’s for a B2B agency that uses **Pipedrive** for their sales.

## 1. The Problem (Why I built this)
Basically, the client had a big issue. Their sales team was wasting *so much time* (like 20 minutes per lead!) just visiting websites to figure out what a company actually does.

They were doing manual research like:
* Opening the website.
* Reading the "About Us" page.
* Trying to guess the target market.

I thought, "Why are we doing this manually? AI can read faster than us." So, I decided to build a bot that does the homework for them.

## 2. How I Solved It
I built an automation in **n8n** that runs automatically.

Here is the flow I created:
1. **Trigger:** Whenever a new "Organization" is added in Pipedrive.
2. **Scraping:** I used **ScrapingBee** (because normal scraping gets blocked easily) to grab the text from their website.
3. **The AI Part:** I sent that text to **GPT-4o**. I gave it a specific prompt: *"Tell me the USP, the target market, and who their competitors are."*
4. **Saving it:** The AI writes a nice summary and saves it as a **Note** right inside Pipedrive.
5. **Alert:** It also sends a message to Slack, so the sales team sees it immediately.

## 3. The Result
Honestly, it turned out great.
Now, the sales guys don't have to "lurk" on websites anymore. By the time they check Pipedrive, the research is already done for them. It saves them hours every week.

It was a fun project to build because it actually solves a real boring task!

## 4. Tech Stack I Used
* **n8n** (obviously!)
* **Pipedrive CRM**
* **OpenAI GPT-4o**
* **ScrapingBee**
* **Slack**
244 changes: 244 additions & 0 deletions Personal_Notebook/03_Pipedrive_AI_Enrichment/workflow.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
{
"id": "",
"meta": {
"instanceId": "",
"templateCredsSetupCompleted": true
},
"name": "Enrich Pipedrive Data with AI",
"nodes": [
{
"id": "b2838678-c796-4c99-a3da-a2cd1b42ea97",
"name": "Pipedrive Trigger - An Organization is created",
"type": "n8n-nodes-base.pipedriveTrigger",
"position": [
820,
380
],
"webhookId": "f5de09a8-6601-4ad5-8bc8-9b3f4b83e997",
"parameters": {
"action": "added",
"object": "organization"
},
"credentials": {
"pipedriveApi": {
"id": "",
"name": "Pipedrive Connection"
}
},
"typeVersion": 1
},
{
"id": "47ee8bfb-2f9d-4790-a929-1533215d6746",
"name": "Pipedrive - Create a Note with OpenAI output",
"type": "n8n-nodes-base.pipedrive",
"position": [
1640,
380
],
"parameters": {
"content": "={{ $json.message.content }}",
"resource": "note",
"additionalFields": {
"org_id": "={{ $(\'Pipedrive Trigger - An Organization is created\').item.json.meta.id }}"
}
},
"credentials": {
"pipedriveApi": {
"id": "",
"name": "Pipedrive Connection"
}
},
"typeVersion": 1
},
{
"id": "7783b531-0469-4bee-868e-4b26a1bb41ba",
"name": "Code - Markdown to Slack Markdown",
"type": "n8n-nodes-base.code",
"position": [
2080,
380
],
"parameters": {
"jsCode": "const inputMarkdown = items[0].json.data;\n\nfunction convertMarkdownToSlackFormat(markdown) {\n let slackFormatted = markdown;\n \n // Convert headers\n slackFormatted = slackFormatted.replace(/^# (.*$)/gim, '*$1*');\n slackFormatted = slackFormatted.replace(/^## (.*$)/gim, '*$1*');\n \n // Convert unordered lists\n slackFormatted = slackFormatted.replace(/^\\* (.*$)/gim, '➡️ $1');\n \n // Convert tables\n const tableRegex = /\n\|.*\|\n\|.*\|\n((|.*|\n)+)/;\n const tableMatch = slackFormatted.match(tableRegex);\n if (tableMatch) {\n const table = tableMatch[0];\n const rows = table.split('\n').slice(3, -1);\n const formattedRows = rows.map(row => {\n const columns = row.split('|').slice(1, -1).map(col => col.trim());\n return `*${columns[0]}*: ${columns[1]}`;\n }).join('\n');\n slackFormatted = slackFormatted.replace(table, formattedRows);\n }\n \n return slackFormatted;\n}\n\nconst slackMarkdown = convertMarkdownToSlackFormat(inputMarkdown);\nconsole.log(slackMarkdown);\n\n// Return data\nreturn [{ slackFormattedMarkdown: slackMarkdown }];\n"
},
"typeVersion": 2
},
{
"id": "cf2b02df-07e8-4ebb-ba3d-bfd294dcfab0",
"name": "Scrapingbee - Get Organization's URL content",
"type": "n8n-nodes-base.httpRequest",
"position": [
1040,
380
],
"parameters": {
"url": "https://app.scrapingbee.com/api/v1",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "api_key",
"value": "<YOUR_SCRAPINGBEE_API_KEY>"
},
{
"name": "url",
"value": "={{ $json.current.<random_api_id_custom_website_field> }}"
},
{
"name": "render_js",
"value": "false"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "906d44f0-7582-4742-9fd8-4c8dfba918e0",
"name": "HTML To Markdown",
"type": "n8n-nodes-base.markdown",
"position": [
1860,
380
],
"parameters": {
"html": "={{ $json.content }}",
"options": {}
},
"typeVersion": 1
},
{
"id": "8c1a5d64-4f38-4f9e-8878-443f750206b7",
"name": "Slack - Notify ",
"type": "n8n-nodes-base.slack",
"position": [
2300,
380
],
"parameters": {
"text": "=*New Organizaton {{ $(\'Pipedrive Trigger - An Organization is created\').item.json.current.name }} created on Pipedrive* :\n\n\n {{ $json.slackFormattedMarkdown }}",
"select": "channel",
"channelId": {
"__rl": true,
"mode": "list",
"value": "",
"cachedResultName": "pipedrive-notification"
},
"otherOptions": {},
"authentication": "oAuth2"
},
"credentials": {
"slackOAuth2Api": {
"id": "",
"name": "Slack Connection"
}
},
"typeVersion": 2.2
},
{
"id": "2414a5d3-1d4b-447b-b401-4b6f823a0cf9",
"name": "OpenAI - Message GPT-4o with Scraped Data",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
1260,
380
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "GPT-4O"
},
"options": {},
"messages": {
"values": [
{
"content": "={{ $json.data }}"
},
{
"role": "system",
"content": "You're an assistant that summarizes website content for CRM entries. The user will provide HTML content from a company's website. Your task is to analyze the HTML content and create a concise summary that includes:\n\n1. A brief description of the company's services or products.\n2. Any information about the company's target market or customer base.\n3. Key points about the company's unique selling propositions or competitive advantages.\n4. Based on the provided information, suggest potential competitors if you know any.\n\nFormat your response as HTML."
}
]
}
},
"credentials": {
"openAiApi": {
"id": "",
"name": "OpenAi Connection"
}
},
"typeVersion": 1.3
}
],
"connections": {
"HTML To Markdown": {
"main": [
[
{
"node": "Code - Markdown to Slack Markdown",
"type": "main",
"index": 0
}
]
]
},
"Code - Markdown to Slack Markdown": {
"main": [
[
{
"node": "Slack - Notify ",
"type": "main",
"index": 0
}
]
]
},
"OpenAI - Message GPT-4o with Scraped Data": {
"main": [
[
{
"node": "Pipedrive - Create a Note with OpenAI output",
"type": "main",
"index": 0
}
]
]
},
"Pipedrive - Create a Note with OpenAI output": {
"main": [
[
{
"node": "HTML To Markdown",
"type": "main",
"index": 0
}
]
]
},
"Scrapingbee - Get Organization's URL content": {
"main": [
[
{
"node": "OpenAI - Message GPT-4o with Scraped Data",
"type": "main",
"index": 0
}
]
]
},
"Pipedrive Trigger - An Organization is created": {
"main": [
[
{
"node": "Scrapingbee - Get Organization's URL content",
"type": "main",
"index": 0
}
]
]
}
}
}
Loading