Email finance when a Pipedrive deal is won
A Pipedrive + Resend agent flow
A rep marks a deal won in Pipedrive and the news travels by luck: maybe a Slack reaction, maybe finance hears about it at month-end when the invoice is already late. A won deal should reach the people who provision and bill on the same day. The agent lists deals with deals_list filtered to recently won, reads the ones closed since the last run, and emails finance with send-email: the company, the amount, the owner, and the close date. Pipedrive answers the list call rather than pushing, so the agent runs on a cadence, hourly or each evening, and a deal already announced in a prior email isn't announced again.
The flow
deals_listList deals with pagination and filtering options.
send-emailSends a single transactional email immediately or scheduled, with HTML/text, attachments, CC/BCC, and tags.
Step by step
- List won deals
The agent calls deals_list filtered to won status with a won-time after the last run, reading each deal's title, value, owner, and the linked organization.
- Skip the already-sent
It records the deal ids it has emailed about, so a deal that stays in the won filter across runs isn't reported twice. Only deals new to the window go into the email.
- Send the notification
send-email delivers a message to finance from your verified domain, one deal per email or a batched summary, carrying the company, amount, owner, and close date, tagged for easy filtering.
Tell your agent
Every hour, list Pipedrive deals marked won since the last run, and email finance@ with the company name, deal value, owner, and won date for each. Skip deals I've already emailed about. If none were won, don't send anything.
Setup
This flow needs both servers connected to your agent. Follow each install guide:
Worth knowing
- deals_list returns the deal with its linked org and person ids, but not the full organization detail. If finance needs the billing contact or address, the agent reads organizations_get or persons_get per deal as a second call.
- Filter and watermark on the won time, not the deal's created or updated time. A deal can be edited after it's won, and you don't want an unrelated edit to re-trigger the announcement.
- send-email requires a verified domain with SPF and DKIM set up in Resend, or finance's mail client may quarantine it. Confirm the domain before the flow goes live.
Questions
- One email per deal or a daily roundup?
- Either. For immediate provisioning, send one email per won deal as it's found. For a calmer inbox, batch the run's won deals into a single summary email. The agent assembles whichever shape you ask for from the same deals_list result.
- Can it include the products on the deal?
- deals_list returns the deal, not its line items. To list products the agent calls deals_list_products per deal and adds them to the email body, which is an extra read for each deal in the run.