Opening Problem Statement
Meet Lisa, a busy sales operations manager juggling two separate platforms daily: Zendesk for customer support and Pipedrive for managing sales contacts. Every morning, Lisa spends at least 2 hours manually transferring recent Zendesk ticket comments into corresponding Pipedrive contacts as notes. This tedious task is error-prone, leading to missed information and delays in sales follow-ups, affecting her team’s responsiveness and client satisfaction.
Her exact pain: spending 10+ hours weekly on this repetitive copy-paste work with frequent mistakes in matching emails, resulting in lost opportunities and frustration.
What This Automation Does
This n8n workflow automates the process Lisa struggles with, connecting Zendesk ticket updates directly to Pipedrive contacts. Here’s what happens when it runs:
- Every day at 9 AM, it checks for Zendesk tickets updated since the last workflow execution.
- Filters tickets where the communication channel is email, extracting the sender’s email address.
- Searches Pipedrive to find the person matching the sender’s email, avoiding duplicates for efficiency.
- Fetches all comments associated with each Zendesk ticket.
- Identifies new comments created after the last execution timestamp.
- Posts these new comments as notes linked to the correct Pipedrive contact, including the sender’s name and content.
- Updates the last execution timestamp to ensure only new activity is processed next time.
The result? Hours saved, no manual errors, and a seamless flow of support communication into sales tracking.
Prerequisites ⚙️
- n8n account (can self-host or use cloud)
- Zendesk account with API access and API token for authentication 🔐
- Pipedrive account with API key integration 🔐
- Basic understanding of n8n nodes such as HTTP Request, Function, and Merge nodes
Step-by-Step Guide
1. Schedule the Automation with Cron Node
Navigate to the n8n editor, add the Cron node:
- Click Add Node → Search “Cron” → Select Cron
- Set the trigger time to every day at 9:00 AM by choosing the “Hour” field and typing “9”.
- You should see the node trigger at your set time, initiating the workflow daily.
- Common mistake: Forgetting to set the correct time zone or PM vs. AM confusion.
2. Retrieve Last Execution Timestamp Using Function Item
This node remembers when the workflow last ran, so only new tickets/comments are processed.
- Add a FunctionItem node named “Get last execution timestamp.”
- Paste the provided JavaScript that checks and sets a global static timestamp if none exists.
- Example code snippet to remember the last run time:
const staticData = getWorkflowStaticData('global'); if(!staticData.lastExecution){ staticData.lastExecution = new Date().toISOString(); } item.executionTimeStamp = new Date().toISOString(); item.lastExecution = staticData.lastExecution; return item; - After running, this node outputs current and last run timestamps.
- Watch out for incorrect use of static data scope which would reset timestamps improperly.
3. Fetch Tickets Updated After Last Execution from Zendesk
Use the Zendesk node configured to query tickets updated since the last run timestamp.
- Add Zendesk node, set operation to “Get All Tickets.”
- Under options, add a query: updated>={{ $json[“lastExecution”] }} to fetch only recent changes.
- Sort tickets by updated date descending.
- Expect to receive a list of tickets with update details.
- Common mistake is forgetting the proper query syntax or incorrect date format.
4. Filter Tickets that are Email Channel
Not all Zendesk tickets are email-based; we only want those from email communications.
- Add an If node named “Channel is email.”
- Set condition: {{$json[“via”].channel}} equals ’email’.
- If true, passes on tickets; else ends workflow or moves to NoOp.
- Make sure the JSON path is accurate to prevent all items being filtered out accidentally.
5. Extract Sender Email and Remove Duplicates
To optimize searching in Pipedrive, we extract unique sender emails.
- Use a Set node named “Set search email” to create a field SearchEmail from ticket JSON: {{$json[“via”].source.from.address}}.
- Then add an ItemLists node “Remove duplicates to make search efficient” to filter unique SearchEmail values.
- Prevents redundant API calls to Pipedrive.
- Watch out for null or malformed emails which would break the search.
6. Search Pipedrive Persons by Email
Match Zendesk ticket email with Pipedrive contact to link notes properly.
- Add Pipedrive node “Search persons by email.”
- Set operation to search “person” resource with term from SearchEmail field.
- Specify to retrieve email fields to verify the match.
- Ensure your Pipedrive API credentials are correctly set.
- Make sure you use “search” operation, not “get” to allow dynamic term input.
7. Rename Fields and Keep Only Needed Ones
Clean up the data to prepare for merging.
- Add Set node “Rename fields and keep only needed fields.”
- Map the Pipedrive person’s id to PipeDrivePersonId and keep their email as primary_email.
- Configure to keep only these set fields.
- Errors often come from not enabling “keep only set” which results in unwanted data.
8. Merge Zendesk Tickets with Pipedrive Person by Email
Combine data to link each ticket’s via.source.from.address with Pipedrive’s primary_email.
- Use Merge node “Add Pipedrive person Id to Zendesk tickets.”
- Select Merge Mode: mergeByKey.
- Set propertyName1: “via.source.from.address” and propertyName2: “primary_email.”
- This merge appends PipeDrivePersonId to matching Zendesk tickets.
- Common mistake: Mismatching keys or wrong key paths cause no merge results.
9. Check if Pipedrive person Id Exists
Only continue processing tickets that have a linked Pipedrive contact.
- Add an If node “Pipedrive person Id found.”
- Set condition to check if PipeDrivePersonId isNotEmpty.
- If true, proceed to fetching comments; else dead-end or NoOp.
10. Get Zendesk Comments for Tickets
Retrieve all comments associated with each ticket from Zendesk API.
- Add HTTP Request node “Get Zendesk comments for tickets.”
- Setup GET request to Zendesk endpoint:
https://n8n.zendesk.com/api/v2/tickets/{{$json["id"]}}/comments - Use Zendesk credentials for authentication.
- Check for successful 200 response with comments array.
11. Merge Tickets with Comments
Combine ticket info and fetched comments for processing.
- Add a Merge node “Add comments to tickets.”
- Merge Mode: inner join by index.
- Ensures comments align correctly with tickets.
12. Process Comments Per Ticket in Batches
Handle each ticket’s comments in small chunks to avoid memory overload.
- Add SplitInBatches node “Process comments per ticket.”
- Set batch size to 1.
- This splits tickets into single units for streamlined processing.
13. Split Comment Arrays Into Separate Items
Convert the array of comments into individual items for filtering new ones.
- Add ItemLists node “Split comments to separate items.”
- Set field to split out: “comments.”
- Next nodes work on individual comment objects, not arrays.
14. Filter Only New Comments Since Last Run
We only want comments created after the last execution timestamp.
- Add If node “New comment.”
- Set condition DateTime: comment’s created_at > lastExecution timestamp.
- If true, pass comment to be added as a note in Pipedrive.
- If false, discard or NoOp.
15. Add Comments as Notes to Pipedrive Contact
Create detailed notes in Pipedrive attached to the correct contact person.
- Pipedrive node “Add comment as a note in Pipedrive.”
- Resource: note; Content template:
Message imported from Zendesk
————————————————
From {{sender name or “Zendesk user”}}
————————————————
{{comment body}} - Person ID mapped to PipeDrivePersonId from merged data.
- This imports the comment text clearly showing the source.
16. Update Last Execution Timestamp After Processing
To avoid duplicate processing, the timestamp is updated after all notes are posted.
- FunctionItem node named “Set new last execution timestamp.”
- Code updates staticData.lastExecution to current run timestamp fetched earlier.
- Runs once per whole workflow execution.
Customizations ✏️
- Change the cron trigger time in the Cron node to run multiple times per day or different intervals.
- Add support for other Zendesk ticket channels (e.g., chat) by modifying the “Channel is email” node conditions.
- Enhance note content formatting in the Add comment as a note in Pipedrive node to include ticket ID or priority.
- Include additional Pipedrive contact fields in the merge and note creation steps, such as deal ID or custom tags.
- Adjust batch sizes in SplitInBatches node based on expected volume for performance tuning.
Troubleshooting 🔧
Problem: “No Pipedrive person found, notes not created”
Cause: Email addresses from Zendesk tickets do not match any Pipedrive contacts.
Solution: Verify the “Search persons by email” node uses exact email fields and that input email data is valid. Add a debug node or log to check email formats.
Problem: “Zendesk comments not fetched or empty response”
Cause: Incorrect Zendesk API URL or authentication failure.
Solution: Confirm HTTP Request node URL uses correct ticket ID in the path and that Zendesk API credentials are correct and active.
Problem: “Workflow does not update last execution timestamp”
Cause: The function node’s static data usage is incorrect or node does not execute in correct order.
Solution: Ensure “Set new last execution timestamp” node runs last and that it updates staticData.lastExecution properly using the timestamp from “Get last execution timestamp” node.
Pre-Production Checklist ✅
- Verify Zendesk API credentials and permissions.
- Check Pipedrive API key and access rights.
- Test cron trigger manually to confirm workflow start.
- Run partial tests with filtered tickets to ensure correct email extraction and person search.
- Confirm comment fetching for a sample ticket returns valid data.
- Test note creation in Pipedrive with sample comment.
- Backup existing critical data before deploying.
Deployment Guide
Activate your workflow in n8n by switching it from draft to active.
Monitor execution logs in the n8n dashboard to catch failures early.
Optionally, set up alerting or error handling nodes if running at scale.
FAQs
Can I use HubSpot instead of Pipedrive in this workflow?
Yes, but you must adjust the Pipedrive nodes to use HubSpot API endpoints and search/contact mapping accordingly.
Does this workflow consume extra API credits?
Yes, especially for frequent Zendesk ticket and comment queries. Optimize by adjusting cron frequency.
Is customer data secure in this setup?
API credentials are securely stored in n8n credentials management. Ensure your n8n environment is secured against unauthorized access.
Conclusion
By building this unique n8n workflow, you’ve automated the tedious process of syncing Zendesk ticket comments as notes into Pipedrive contacts. Lisa saves over 10 hours weekly, eliminating manual errors and improving the sales and support team’s efficiency.
Next automation ideas include syncing support tickets to CRM deals, integrating Slack notifications on new tickets, or automating follow-up email reminders based on ticket activity.
Keep experimenting with n8n to tailor automations that save you time and sanity!