Setup Guide
1
Connect Factr API
Store your Factr API key in your SendGrid integration backend.
2
Create a contact enrichment workflow
Use SendGrid webhooks to trigger Factr on new contact creation.
3
Add enrichment to contact data
Store the returned facts as custom fields in SendGrid.
4
Reference in email templates
Use SendGrid's substitution tags to include personalized facts in emails.
Code Example
JavaScript / Node.js
// SendGrid contact enrichment
const sgMail = require('@sendgrid/mail');
const factrApiKey = process.env.FACTR_API_KEY;
async function enrichContact(email) {
// Call Factr API
const response = await fetch('https://factr.polsia.app/api/enrich', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email, apiKey: factrApiKey })
});
const { fact } = await response.json();
// Store in SendGrid custom field
return {
email,
custom_fields: {
enriched_fact: fact
}
};
}
Key Benefits
- Higher email open rates with personalization
- Automated contact enrichment pipeline
- No manual data entry needed
- A/B test personalized vs generic copy