SendGrid + Salesforce

Connect SendGrid and Salesforce to Automate Email Marketing and CRM Sync

Keep sales and marketing on the same page by pushing email engagement data straight into Salesforce.

Why integrate SendGrid and Salesforce?

SendGrid and Salesforce are two of the most widely used platforms in modern sales and marketing stacks, but keeping them in sync manually creates data silos, missed follow-ups, and wasted revenue. By integrating SendGrid with Salesforce on tray.ai, teams can automatically log email activity, update lead and contact records, and trigger personalized campaigns based on CRM events. Sales reps get the full picture of email engagement, and marketing can act on real-time CRM data without anyone having to move it manually.

Automate & integrate SendGrid & Salesforce

Use case

Sync Email Engagement Events to Salesforce Contact Records

Automatically log SendGrid email events — opens, clicks, bounces, and unsubscribes — as activity records on the corresponding Salesforce Contacts or Leads. Sales reps get a real-time view of prospect engagement without ever leaving Salesforce. No more manually cross-referencing email reports with CRM data.

Use case

Trigger SendGrid Email Campaigns from Salesforce CRM Events

Launch targeted SendGrid email campaigns the moment something happens in Salesforce — a lead hits a specific stage, a deal closes, or a contact gets added to a campaign. Communication goes out on time and in context, with no manual handoff required from the marketing team.

Use case

Update Salesforce Lead Scores Based on SendGrid Email Behavior

Automatically adjust lead scores in Salesforce whenever a contact engages with a SendGrid email — whether they open it, click through, or ignore it entirely. Multiple link clicks can instantly bump a lead score and alert a rep to follow up, while disengagement can trigger a re-engagement workflow. Lead prioritization stays current and driven by real behavior.

Use case

Sync Salesforce Contacts and Leads to SendGrid Marketing Lists

Automatically add, update, or remove contacts in SendGrid marketing lists whenever records change in Salesforce. A lead converts, an opportunity closes, a contact opts out — your SendGrid lists reflect it immediately. No stale data, no emailing the wrong people.

Use case

Automate Onboarding Email Sequences When Salesforce Opportunities Close

When a Salesforce opportunity is marked Closed Won, automatically enroll the new customer in a tailored SendGrid onboarding email sequence. Personalize it using data pulled directly from Salesforce — product purchased, account owner, company name. Sales hands off to customer success without anyone lifting a finger.

Use case

Handle SendGrid Bounces and Unsubscribes in Salesforce

When SendGrid records a hard bounce or unsubscribe, automatically update the corresponding Salesforce Contact or Lead to flag the invalid email or opt-out status. This stops reps from continuing to reach out to bad addresses and keeps your org compliant with GDPR and CAN-SPAM. You can also trigger an internal alert so reps can track down an alternative contact method.

Use case

Create or Update Salesforce Leads from SendGrid Form Submissions

When a contact clicks a demo request link or otherwise signals new interest through a SendGrid email, automatically create or update a Lead in Salesforce with relevant engagement context. Route the lead to the right sales rep based on territory or account ownership rules already in Salesforce. Email marketing activity turns directly into CRM pipeline.

Get started with SendGrid & Salesforce integration today

SendGrid & Salesforce Challenges

What challenges are there when working with SendGrid & Salesforce and how will using Tray.ai help?

Challenge

Matching SendGrid Email Events to the Right Salesforce Records

SendGrid events are keyed by email address, but Salesforce may have duplicate Contacts, multiple Leads with the same email, or converted records — making it hard to reliably match an event to the correct CRM record without custom logic.

How Tray.ai Can Help:

tray.ai's built-in data transformation and conditional logic tools let you define sophisticated matching rules — prioritizing Contacts over Leads, deduplicating by email, or checking account association — so every SendGrid event lands on the correct Salesforce record.

Challenge

Handling High-Volume SendGrid Webhook Event Streams

Active email campaigns can generate thousands of open, click, and bounce events per hour. A poorly designed integration can drop events, hit Salesforce API rate limits, or create duplicate records under that kind of load.

How Tray.ai Can Help:

tray.ai handles high-throughput webhook ingestion with built-in queuing and retry logic, and batches Salesforce API calls to stay within rate limits without losing events, even during large campaign sends.

Challenge

Keeping Custom Fields in Sync Between Both Platforms

SendGrid and Salesforce both support custom fields, but their schemas rarely align out of the box. Mapping SendGrid contact properties to Salesforce Lead or Contact fields takes care — especially as schemas change over time.

How Tray.ai Can Help:

tray.ai's visual data mapper lets you define and update field mappings between SendGrid and Salesforce without writing code. When either platform adds or changes a field, you can update the workflow in minutes.

Challenge

Managing Unsubscribe and Compliance Data Across Both Systems

When a contact unsubscribes in SendGrid, that opt-out needs to hit Salesforce immediately. If it doesn't, a sales rep might keep emailing them — which is a real compliance risk under GDPR and CAN-SPAM.

How Tray.ai Can Help:

tray.ai listens for SendGrid unsubscribe events in real time and instantly updates the corresponding Salesforce record's opt-out fields, creating an auditable compliance trail and stopping further outreach from either platform.

Challenge

Authenticating and Maintaining Secure Connections Between Both Services

Managing API keys for SendGrid and OAuth tokens for Salesforce — including token refresh cycles and permission scopes — can be brittle. Silent authentication failures break integrations with no warning.

How Tray.ai Can Help:

tray.ai's centralized authentication management stores and automatically refreshes credentials for both SendGrid and Salesforce, so workflows don't break because of expired tokens or rotated API keys. All secrets are stored with enterprise-grade encryption.

Start using our pre-built SendGrid & Salesforce templates today

Start from scratch or use one of our pre-built SendGrid & Salesforce templates to quickly solve your most common use cases.

SendGrid & Salesforce Templates

Find pre-built SendGrid & Salesforce solutions for common use cases

Browse all templates

Template

Log SendGrid Email Opens and Clicks to Salesforce Activity Feed

This template listens for open and click events from SendGrid webhooks and automatically creates a Task or Activity record on the matching Salesforce Contact or Lead, keeping the CRM activity timeline current with email engagement data.

Steps:

  • Receive SendGrid email event webhook payload (open, click, bounce, or unsubscribe)
  • Look up the matching Contact or Lead in Salesforce by email address
  • Create or update a Task or Activity record on the matched Salesforce record with event details and timestamp

Connectors Used: SendGrid, Salesforce

Template

Enroll Salesforce Contacts in SendGrid Campaigns Based on Opportunity Stage

This template watches for Salesforce opportunity stage changes and automatically adds the associated contact to the right SendGrid marketing list or triggers a targeted email campaign, so the right message goes out at the right point in the sales cycle.

Steps:

  • Poll Salesforce for opportunity records where Stage has changed within a defined time window
  • Retrieve the associated Contact record and map relevant personalization fields
  • Add the contact to the corresponding SendGrid list or send a transactional email via SendGrid API based on the new stage

Connectors Used: SendGrid, Salesforce

Template

Sync Salesforce Contacts to SendGrid Marketing Lists in Real Time

This template keeps your SendGrid contact lists in sync with Salesforce by automatically adding, updating, or removing contacts whenever their Salesforce records are created, modified, or deleted.

Steps:

  • Trigger on Salesforce Contact or Lead create, update, or delete events
  • Map Salesforce field values to SendGrid contact properties including custom fields
  • Upsert or delete the contact in the appropriate SendGrid marketing list based on the triggering event type

Connectors Used: SendGrid, Salesforce

Template

Update Salesforce Lead Score When SendGrid Email Is Clicked

This template captures high-intent click events from SendGrid and automatically increments the lead score field on the corresponding Salesforce Lead, then alerts the assigned sales rep when a score threshold is crossed.

Steps:

  • Receive a SendGrid click event via webhook and extract the recipient email address and link clicked
  • Locate the matching Lead in Salesforce and retrieve the current lead score value
  • Update the lead score field in Salesforce and create a follow-up Task for the assigned rep if the score exceeds a defined threshold

Connectors Used: SendGrid, Salesforce

Template

Trigger Onboarding Email Sequence in SendGrid on Salesforce Closed Won

This template kicks off a personalized SendGrid onboarding email sequence the moment a Salesforce opportunity is marked Closed Won, using account and contact data from Salesforce to personalize each message.

Steps:

  • Poll or receive a Salesforce trigger when an Opportunity Stage changes to Closed Won
  • Fetch the associated Account and Contact details from Salesforce to build a personalization data payload
  • Enroll the contact in a SendGrid dynamic template drip sequence using the personalization payload

Connectors Used: SendGrid, Salesforce

Template

Mark Salesforce Contacts as Invalid on SendGrid Hard Bounce

This template listens for hard bounce events from SendGrid and automatically updates the matching Salesforce Contact or Lead to flag the email address as invalid, stopping further outreach and keeping CRM data clean.

Steps:

  • Receive a SendGrid hard bounce webhook event and extract the bounced email address
  • Search Salesforce for a Contact or Lead matching the bounced email address
  • Update the Email Opt Out field and add a note to the Salesforce record indicating the bounce reason and date

Connectors Used: SendGrid, Salesforce