Daily Salesforce opportunity activity sync from Factors.ai
Every weekday at 6am, pull yesterday's account activity from Factors.ai and stamp it as a note on each open Salesforce opportunity's account.
Build me a daily Salesforce opportunity activity sync workflow.
Trigger: cron, every weekday (Monday through Friday) at 6:00 AM in the user's local timezone.
This is a deterministic pipeline applied to every row, with no judgment calls, so build it as a code workflow.
Step 1 — Pull open opportunities from Salesforce. Use the Salesforce SOQL Query operation to run a query against the Opportunity object that returns Id, Name, OwnerId, AccountId, and Account.Website for every opportunity where IsClosed = false and LastModifiedDate is within the last 45 days. Order by LastModifiedDate descending.
Step 2 — For each opportunity in that result set, derive the bare domain from Account.Website. Strip the protocol, any www. prefix, any path, query string, or trailing slash, and lowercase the result. If Account.Website is empty or cannot be parsed into a domain, skip that opportunity and move on.
Step 3 — Call the Factors.ai Get Account Journey operation using that bare domain, with a from/to window covering the trailing 24 hours (yesterday 00:00:00 through yesterday 23:59:59 in the user's timezone). Handle a 404 from Factors as 'no activity' rather than an error.
Step 4 — If the response contains no events for that account, skip the write entirely and continue to the next opportunity. Do not create empty notes.
Step 5 — If there is activity, format the events into a single short note. Title it something like 'Factors activity — {yesterday's date}'. The body should be a bulleted list, one line per event, in the form '[HH:MM] {event_name} — {user_name or anonymous}'. Cap the list at the 20 most recent events so the note stays readable.
Step 6 — Call the Salesforce Add Note to Account operation, attaching the formatted note to the opportunity's AccountId (not the opportunity itself). Use the OwnerId from the opportunity as the note owner if the operation accepts it.
Continue the loop until every opportunity has been processed. Log a short summary line per opportunity (domain, event count, wrote/skipped) so a human can audit the run.
Use the user's connected Salesforce credential and Factors.ai private token. Treat individual opportunity failures as soft errors — log and continue — rather than failing the whole run.
Additional information
What does this prompt do?
- Looks up every open Salesforce opportunity that was updated in the last 45 days each weekday morning.
- Pulls yesterday's website visits and intent signals for each account from Factors.ai.
- Drops a tidy, timestamped note onto the matching Salesforce account so reps see the activity where they already work.
- Skips any account with no new activity so the CRM stays clean and reps only see real signal.
What do I need to use this?
- A Salesforce login with permission to read opportunities and add notes to accounts.
- A Factors.ai account with a private token for the project that tracks your target accounts.
- Account websites filled in on the Salesforce account records you care about (the workflow uses the domain to look up activity).
How can I customize it?
- Change the schedule (default is every weekday at 6am) or the opportunity lookback window (default is the last 45 days of updates).
- Tighten the filter so it only covers opportunities at a specific stage, above a deal-size threshold, or owned by a particular team.
- Edit how each note is formatted, or branch out and send a short Slack ping when a top-tier account suddenly lights up.
Frequently asked questions
Do my reps need a Factors.ai login?
What happens if an opportunity's account has no website?
Will this create duplicate notes if a rep is also checking Factors manually?
Can the activity go somewhere other than a Salesforce note?
Will this blow through my Salesforce API limits?
Related templates
Surface buyer intent where your reps already work.
Connect Salesforce and Factors.ai once, and Geni stamps yesterday's account activity onto every open opportunity every weekday at 6am.