Overview
This guide will show you how to automate sending physical letters via Stannp's API using Salesforce Flow Builder. You can trigger this action based on Salesforce events, such as new contact creation, lead qualification, or opportunity updates.
The HTTP Callout Action is only available in Enterprise, Performance, Unlimited, and Developer Editions of Salesforce. If you're using a lower-tier edition, you'll need to use Apex code or an external integration tool like Make.com or Zapier instead.
Prerequisites
Before you begin, ensure you have:
- A Stannp account and your API key (found under Account Settings > API Keys).
- Salesforce admin access to create and activate Flows.
- A Salesforce edition that supports HTTP Callouts (Enterprise, Performance, Unlimited, or Developer).
- Complete address details in Salesforce records to ensure correct delivery.
Step 1: Access Flow Builder
- Log in to Salesforce.
- Click on the App Launcher (grid icon in the top-left corner) and search for "Automation".
- Open the Automation App and navigate to Flow Builder.
- Click "New Flow" and select Record-Triggered Flow.
- Choose the Salesforce Object that will trigger the letter (e.g., Contact, Lead, or Opportunity).
- Set the Trigger Condition (e.g., when a new Contact is created or updated).
- Click "Done" to save.
Step 2: Add an HTTP Callout Action
Note: The HTTP Callout Action is only available for Enterprise, Performance, Unlimited, and Developer Editions. If you do not have access to this feature, consider using Apex code or a third-party integration tool instead.
Finding HTTP Callout in Flow Builder
- Click the "+" button at the step where you want the API request to be sent.
- Select "Action" from the menu.
- In the New Action window, search for "HTTP Callout".
- If this is your first time using HTTP Callouts, click "Create HTTP Callout".
Configuring the HTTP Callout
- Callout Name: "Send letters via stannp"
- Method: POST
- Endpoint URL:
https://api-us1.stannp.com/v1/letters/create?api_key=YOUR_API_KEY
- Authentication Type: None (authentication is handled via the API key in the query parameter).
Step 3: Configure the Request Body
In the Request Body, use Salesforce merge fields to pass customer data into the API call.
{
"recipient": {
"firstname": "{!$Record.FirstName}",
"lastname": "{!$Record.LastName}",
"address1": "{!$Record.MailingStreet}",
"city": "{!$Record.MailingCity}",
"postcode": "{!$Record.MailingPostalCode}",
"country": "{!$Record.MailingCountry}"
},
"template": 12345,
"test": false,
"duplex": true,
"clearzone": true,
"post_unverified": true,
"tags": "salesforce, new_lead",
"addons": "FIRST_CLASS"
}
Key Parameters Explained:
recipient
: Uses Salesforce fields to map lead/contact address details to Stannp.template
: A Stannp template ID for the letter (replace12345
with your template ID).test
: Set totrue
to generate a test letter without mailing it.duplex
:true
prints on both sides,false
prints on one side.clearzone
:true
ensures clear zones are formatted correctly for mailing.post_unverified
: Iffalse
, letters will not be sent if the address is unverified.tags
: Adds searchable tags in Stannp for reporting.addons
: Use"FIRST_CLASS"
to upgrade to first-class postage.
Step 4: Save & Activate the Flow
- Click "Save", enter a Flow Name (e.g., "Send Letter on New Contact").
- Click "Activate" to enable the flow.
Once activated, whenever a new Contact (or chosen object) is created, the Flow will automatically send the data to Stannp, triggering a physical letter to be mailed.
Testing & Troubleshooting
-
Test with a Sample Contact
- Create a new Contact with full address details.
- Check your Stannp Dashboard to see if the request was received.
-
Check Salesforce Flow Logs
- If letters are not being sent, go to Setup > Flows > Debug to inspect errors.
-
Verify API Response
- If there are errors in Salesforce logs, ensure your API key, template ID, and address data are correct.
Alternative Solutions for Non-Supported Editions
If you are using Salesforce Professional or Essentials Edition, you do not have access to HTTP Callouts in Flow Builder. Instead, you can:
- Use Apex Code: If you have developer resources, an Apex class can be created to send HTTP requests via a trigger.
- Integrate with Third-Party Tools: Services like Make.com, Zapier, or Workato can be used to connect Salesforce with Stannp.
- Manual CSV Export & Upload: If automation is not required, you can export customer data and upload it to Stannp manually.
Conclusion
By integrating Salesforce Flow Builder with Stannp, you can automate direct mail campaigns and customer outreach using physical letters triggered by Salesforce events. If your edition supports HTTP Callouts, this can be done natively in Flow Builder. Otherwise, consider Apex or third-party integration tools to achieve the same functionality.