I'm working with a company that has a custom object trigger and some apex code that sends out email notifications when certain events occur using Messaging.SingleEmailMessage(). The company would like these emails to be sent through Pardot so that Pardot has a record of all email communication.

Right now, the apex code gets the mail recipients, and parameters to create a custom body, from the custom object and constructs the email.

How could a process like this be implemented using Pardot to send the emails rather than Messaging.SingleEmailMessage()?

  • Call Pardot API or write the fields to whatever object that syncs to Pardot and use automation in Pardot.
    – identigral
    Apr 7, 2022 at 1:04

1 Answer 1


Yes you absolutely can, though as @identigral mentions in his comment you will need to use the Pardot API.

I've previously written a blog post that describes how to setup your Salesforce environment so that you can make Pardot API calls. Check it out here: https://thespotforpardot.com/2021/02/02/pardot-api-and-getting-ready-with-salesforce-sso-users-part-3a-connecting-to-pardot-api-from-apex/

In short, you will need to:

  1. Create a new User for this integration
  2. Create a Salesforce Self-Signed Certificate
  3. Create a Connected App, allowing the User to be pre-authorized
  4. Create a Named Credential
  5. Write some APEX that actually makes the Send One-to-One Email API call (using V3 or V4 API)

You may want to consider having this APEX expose an Action that can be called by Flow exposing this to their Admins for a more flexible integration...but this last bit is more opinion rather than what's needed to accomplish your goal.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .