diff --git a/workflows/Healthcare policy monitoring with ScrapeGraphAI, Pipedrive and email alerts-12073/healthcare_policy_monitoring_with_scrapegraphai_pipedrive_and_email_alerts.json b/workflows/Healthcare policy monitoring with ScrapeGraphAI, Pipedrive and email alerts-12073/healthcare_policy_monitoring_with_scrapegraphai_pipedrive_and_email_alerts.json new file mode 100644 index 000000000..e8d72160d --- /dev/null +++ b/workflows/Healthcare policy monitoring with ScrapeGraphAI, Pipedrive and email alerts-12073/healthcare_policy_monitoring_with_scrapegraphai_pipedrive_and_email_alerts.json @@ -0,0 +1 @@ +{"id":"y0Yk7da21T4u9zlp","meta":{"instanceId":"99f4e9e67f2a926c174453b6675a71cc5fb71c1fb19cfc06d50531053c661324","templateCredsSetupCompleted":true},"name":"Breaking News Aggregator with SendGrid and PostgreSQL","tags":[],"nodes":[{"id":"24379ab1-0826-44f4-b87e-fe68606d7303","name":"Run Workflow","type":"n8n-nodes-base.manualTrigger","position":[-3312,96],"parameters":{},"typeVersion":1},{"id":"3a835a7e-3e2e-4550-af04-9ac916fde8ee","name":"Define Target URLs","type":"n8n-nodes-base.code","position":[-3104,96],"parameters":{"jsCode":"// List the policy or proposal pages you want to monitor.\n// Add or remove URLs as needed.\nreturn [\n {\n json: {\n url: \"https://www.hhs.gov/about/news/2025/01/15/new-health-policy.html\",\n source: \"HHS\"\n }\n },\n {\n json: {\n url: \"https://www.cms.gov/newsroom/fact-sheets/2025-proposed-rule.html\",\n source: \"CMS\"\n }\n }\n];"},"typeVersion":2},{"id":"e4a80646-1d8c-46db-b136-434d4e576be6","name":"Loop URLs","type":"n8n-nodes-base.splitInBatches","position":[-2912,96],"parameters":{"options":{}},"typeVersion":3},{"id":"a8b45b6b-c0c0-433d-924d-8535748d283c","name":"Scrape Policy Page","type":"n8n-nodes-scrapegraphai.scrapegraphAi","position":[-2704,96],"parameters":{"userPrompt":"Extract the healthcare policy or proposal title, a concise summary no longer than 300 characters, the publication date, any reference or docket number if present, and the canonical source URL. Respond exactly as JSON with keys: title, summary, publication_date, reference_number, source_url.","websiteUrl":"={{ $json.url }}"},"typeVersion":1},{"id":"84aba8ee-430e-47d8-8ce7-ab0ac61c6363","name":"Enrich with Metadata","type":"n8n-nodes-base.httpRequest","position":[-2512,96],"parameters":{"url":"={{ 'https://example-policy-enrichment-api.com/v1/enrich?url=' + encodeURIComponent($json.source_url) }}","options":{}},"typeVersion":4},{"id":"d8eb175a-d58e-4703-8d56-c124ec59bfb1","name":"Transform & Clean Data","type":"n8n-nodes-base.code","position":[-2304,96],"parameters":{"jsCode":"// Merge scraped data with enrichment service response\nconst scraped = items[0].json;\nconst enrichment = scraped && scraped.metadata ? scraped.metadata : {};\nreturn [\n {\n json: {\n title: scraped.title,\n summary: scraped.summary,\n publication_date: scraped.publication_date,\n reference_number: scraped.reference_number || '',\n source_url: scraped.source_url,\n topics: enrichment.topics || [],\n sentiment: enrichment.sentiment || 'neutral',\n source: $json.source,\n original_url: $json.url\n }\n }\n];"},"typeVersion":2},{"id":"ba49fb0d-f96b-4267-9d6f-02a042231184","name":"Generate Unique ID","type":"n8n-nodes-base.code","position":[-2304,288],"parameters":{"jsCode":"// Generate a lightweight unique identifier for deduplication\nconst crypto = require('crypto');\nconst item = $input.item.json;\nconst idString = `${item.title}-${item.publication_date}`;\nitem.policy_id = crypto.createHash('md5').update(idString).digest('hex');\n// Flag as recent if within last 30 days\nconst days30 = 30 * 24 * 60 * 60 * 1000;\nitem.is_recent = (new Date() - new Date(item.publication_date)) < days30;\nreturn [{ json: item }];"},"typeVersion":2},{"id":"3d415747-a9fa-43f7-b6e3-804bd6ce0fd1","name":"Is Recent Policy?","type":"n8n-nodes-base.if","position":[-2112,288],"parameters":{"options":{},"conditions":{"boolean":[{"value1":"={{ $json.is_recent }}","operation":"true"}]}},"typeVersion":2},{"id":"e5be5576-1c7d-4d23-96f6-323b4b9a5715","name":"Prepare Email Content","type":"n8n-nodes-base.set","position":[-1696,112],"parameters":{"options":{}},"typeVersion":3.4},{"id":"2aceb7d5-af40-4671-9c50-a280d4d0c323","name":"Send Policy Alert","type":"n8n-nodes-base.emailSend","position":[-1568,288],"webhookId":"6a886d74-0ac7-4737-b9b7-d4dfc678c507","parameters":{"options":{},"subject":"={{ $json.emailSubject }}","toEmail":"user@example.com","fromEmail":"user@example.com"},"typeVersion":2.1},{"id":"93b76459-5dd8-450d-ae84-8c0cc3bc5d68","name":"Workflow Overview","type":"n8n-nodes-base.stickyNote","position":[-3904,-320],"parameters":{"width":550,"height":450,"content":"## How it works\n\nThis workflow lets healthcare administrators spot new policy proposals the moment they appear. Start the manual trigger whenever you want to run a sweep. A Code node lists the URLs you care about and a Batch node steps through them one at a time. ScrapeGraphAI extracts structured details such as title, summary, date and reference number straight from each page. An HTTP Request then enriches that data with topic tags and sentiment from an external policy-analysis API. Code nodes clean the output, create a unique hash for deduplication and tag anything published in the last thirty days. Recent items are written to Pipedrive as new deals and an email alert lands in your inbox so you never miss an important change.\n\n## Setup steps\n\n1. Add ScrapeGraphAI credentials in the scrape node.\n2. Insert your enrichment API key in the HTTP Request credentials.\n3. Connect your Pipedrive account and create custom fields \"Policy Date\" and \"Reference Number\".\n4. Configure the SMTP credentials for the Email Send node.\n5. Replace the placeholder target URLs in the first Code node.\n6. Save, execute manually and confirm records & email arrive."},"typeVersion":1},{"id":"d209e190-01b6-47f9-9be7-cb2244d6c871","name":"Section – Data Collection","type":"n8n-nodes-base.stickyNote","position":[-3344,-256],"parameters":{"color":7,"width":450,"height":670,"content":"## Data Collection\n\nThis group covers everything from the Manual Trigger through to the AI-powered scraping of the policy webpages. Kicking off with the **Run Workflow** node lets you decide when to poll rather than depending on a schedule—handy while you tweak and test. The next Code node is your single source of truth for which government or industry URLs to watch; simply paste or remove addresses to refine your monitoring list. **Loop URLs** splits that array into manageable batches so heavy sites don’t slam your bandwidth. Finally, **Scrape Policy Page** leverages ScrapeGraphAI’s natural-language prompt to pull the policy’s title, summary, publication date and reference number without brittle CSS selectors. All data leaves this section as neatly formatted JSON so that later nodes can enrich, filter or store it without additional parsing headaches."},"typeVersion":1},{"id":"cfa7fca3-bdda-4cc1-a7af-43788f32acc8","name":"Section – Enrichment & Transformation","type":"n8n-nodes-base.stickyNote","position":[-2864,-240],"parameters":{"color":7,"width":450,"height":638,"content":"## Enrichment & Transformation\n\nOnce a raw policy record arrives, the HTTP Request node calls an external analysis API that tags the document with policy areas and provides a quick sentiment snapshot. This extra context helps stakeholders gauge urgency at a glance. The **Transform & Clean Data** Code node merges the enrichment payload with the fields returned by ScrapeGraphAI, normalises date formats and removes empty attributes. **Generate Unique ID** then hashes the title and publication date into a stable identifier so you can spot duplicates across runs. It also flags whether the policy was published within the last thirty days, a simple heuristic that feeds the next IF node. By the time records leave this section they’re fully enriched, validated and stamped with all metadata required for long-term tracking in downstream systems."},"typeVersion":1},{"id":"76a66f82-feca-491f-9991-4d6ed4412a97","name":"Section – Storage","type":"n8n-nodes-base.stickyNote","position":[-2384,-240],"parameters":{"color":7,"width":450,"height":670,"content":"## Storage & Deduplication\n\nThe **Is Recent Policy?** IF node acts as the workflow’s first gatekeeper, ensuring only fresh items progress to Pipedrive. Policies older than thirty days quietly exit here to save CRM clutter. The **Upsert Policy in Pipedrive** node creates a new deal for every passing item and populates custom fields for publication date and reference number so analysts can filter or report directly inside Pipedrive. Because each deal title is the exact policy title and the unique hash lives in a custom field, it’s easy to spot duplicates or link follow-up activities later. Storing policies in a sales-style pipeline might seem odd at first, but Pipedrive’s stages, activities and notes double perfectly as an editorial queue for policy analysis."},"typeVersion":1},{"id":"c7f0cf3b-cf1f-4cdb-a153-4067acf209f2","name":"Section – Notifications","type":"n8n-nodes-base.stickyNote","position":[-1872,-240],"parameters":{"color":7,"width":450,"height":686,"content":"## Notifications & Alerts\n\nEvery time a new record lands in Pipedrive the workflow builds an immediate email so nobody has to watch dashboards 24/7. The **Prepare Email Content** Set node crafts a human-readable subject and body using n8n expressions, pulling in title, summary, publication date and a direct link. This means recipients can scan the update without leaving their inbox. The **Send Policy Alert** node then dispatches the message via your SMTP credentials. Because message content is created in a Set node rather than Code, non-technical users can tweak wording without touching JavaScript. If you’d like to extend alerts to Slack or Teams later, simply branch from this point—your payload is already clean and complete."},"typeVersion":1},{"id":"55c7e4f9-eb01-40c0-8c8f-04429c4a8320","name":"Create an activity","type":"n8n-nodes-base.pipedrive","position":[-1856,288],"parameters":{"resource":"activity","additionalFields":{}},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"af1b8fe5-54cb-4d77-a95b-646d5e02262e","connections":{"Loop URLs":{"main":[[{"node":"Scrape Policy Page","type":"main","index":0}]]},"Run Workflow":{"main":[[{"node":"Define Target URLs","type":"main","index":0}]]},"Is Recent Policy?":{"main":[[{"node":"Create an activity","type":"main","index":0}]]},"Create an activity":{"main":[[{"node":"Prepare Email Content","type":"main","index":0}]]},"Define Target URLs":{"main":[[{"node":"Loop URLs","type":"main","index":0}]]},"Generate Unique ID":{"main":[[{"node":"Is Recent Policy?","type":"main","index":0}]]},"Scrape Policy Page":{"main":[[{"node":"Enrich with Metadata","type":"main","index":0}]]},"Enrich with Metadata":{"main":[[{"node":"Transform & Clean Data","type":"main","index":0}]]},"Prepare Email Content":{"main":[[{"node":"Send Policy Alert","type":"main","index":0}]]},"Transform & Clean Data":{"main":[[{"node":"Generate Unique ID","type":"main","index":0}]]}}} \ No newline at end of file