Validate HubSpot contact emails, automate bounce suppression, score engagement with bot filtering, and detect high-intent leads. Direct Custom Code Actions for Operations Hub or middleware via Zapier and Make.
7 patterns using HubSpot Custom Code Actions (Operations Hub) to call the MailOdds API directly from workflows. Each runs as a Node.js function inside HubSpot with no external infrastructure.
HubSpot users sending via MailOdds get automatic email authentication. Add one NS record for mo.yourdomain.com and MailOdds manages SPF, DKIM, MX, and DMARC automatically. No ongoing DNS maintenance.
is_bot = true when the event came from a security scanner, link prefetcher, or corporate email gateway (not a human). Common with Barracuda, Proofpoint, and Mimecast.
is_mpp = true when the event came from Apple Mail Privacy Protection, which pre-fetches all images and inflates open counts. Affects roughly 50% of iOS/macOS mail users.
Both fields are Booleans on engagement events (opened, clicked). Always guard with == true since they may be absent on non-engagement events.
Validate emails in real time inside a HubSpot workflow. A Custom Code Action calls the MailOdds API with enhanced depth and writes status, action, and sub_status back to contact properties.
Run standard (syntax + DNS) validation first, then only promote qualified contacts to enhanced (SMTP) validation. Typical savings: 72% on validation costs for lists with high disposable/syntax-error rates.
When MailOdds detects a hard bounce via webhook, automatically add the address to your suppression list. Prevents repeated sends to dead addresses and protects sender reputation.
Before enrolling contacts in a campaign workflow, submit the entire list for batch validation. The Custom Code Action posts emails to the bulk endpoint, then a follow-up workflow processes results.
Receive webhook events for opens and clicks, filter out bot and Apple Mail Privacy Protection noise, then update custom HubSpot properties with real human engagement data for lead scoring.
Pull aggregate validation and sending telemetry from the MailOdds API and sync it to custom HubSpot properties or an external dashboard. Uses ETag caching to minimize API calls.
Receive intent.hot_lead webhook events when MailOdds detects high-intent engagement patterns. Increment the contact lead score and create a task for the assigned sales rep.
If you are on HubSpot Starter or do not have Operations Hub, use Zapier or Make to connect HubSpot to MailOdds without Custom Code Actions.
Watch contacts, validate, update properties
View guideVisual CRM automation scenarios
View guideSelf-hosted HubSpot API workflows
View guide// Zapier Code Step - Validate HubSpot Contact Email
const response = await fetch('https://api.mailodds.com/v1/validate', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
email: inputData.email // Mapped from HubSpot contact email
})
});
const result = await response.json();
return {
email: result.email,
status: result.status,
action: result.action,
is_valid: result.action === 'accept',
disposable: result.disposable
}; // Make Scenario - HubSpot Contact Validation
// 1. HubSpot: Watch New Contacts (trigger)
// 2. HTTP Module: POST to https://api.mailodds.com/v1/validate
// Headers: Authorization: Bearer YOUR_API_KEY
// Body: { "email": "{{1.properties.email}}" }
// 3. HubSpot: Update Contact
// Property "email_validation_status" = {{2.data.status}}
// Property "email_action" = {{2.data.action}}
// 4. Router: Branch by action
// - "reject" -> Add to "Invalid Emails" list
// - "accept" -> Continue to enrollment workflows In HubSpot Settings > Properties, create: email_validation_status (text), email_validation_action (text), email_sub_status (text), engagement_score (number), last_engagement_type (text).
Go to Automation > Workflows. Create a contact-based workflow. Add a Custom Code action (requires Operations Hub Professional+). Map the contact email as an input field.
Copy the Direct Validation code from the first card above. Replace YOUR_API_KEY with your MailOdds API key. Define output fields matching the callback outputFields.
After the Custom Code action, add a "Set Contact Property" action. Map email_status, email_action, and email_sub_status to your custom properties.
For engagement scoring and bounce suppression, set up webhook URLs in the MailOdds dashboard. Point them to a Zapier Webhook trigger or your own server that feeds into HubSpot workflows.
Create HubSpot active lists filtered by email_validation_action. Use "accept" for clean sends, "reject" for suppression, and "risky" for re-validation.
Beyond contact validation, MailOdds monitors your sender health, DMARC compliance, and campaign performance. Surface these insights in HubSpot custom cards and workflow alerts.
Check your sender reputation, bounce rate, and complaint rate from a HubSpot workflow. If the reputation score drops below your threshold, trigger an internal alert or create a task for your deliverability team.
// HubSpot Custom Code Action - Check Sender Health
const axios = require('axios');
exports.main = async (event, callback) => {
const response = await axios.get('https://api.mailodds.com/v1/sender-health', {
headers: { 'Authorization': 'Bearer ' + process.env.MAILODDS_API_KEY }
});
const health = response.data;
callback({
outputFields: {
reputation_score: health.reputation_score,
bounce_rate: (health.bounce_rate * 100).toFixed(2) + '%',
complaint_rate: (health.complaint_rate * 100).toFixed(3) + '%',
authentication_health: health.authentication_health,
needs_attention: health.reputation_score < 70
}
});
};
// Use in HubSpot workflow: if needs_attention is true,
// send internal notification or create a task Related: Sender Reputation Monitoring
Run a daily scheduled workflow that checks your DMARC trend data. If authentication failures exceed your threshold, send a Slack notification or create a HubSpot task for your ops team.
// HubSpot Custom Code Action - DMARC Compliance Check
const axios = require('axios');
exports.main = async (event, callback) => {
const domain = 'yourdomain.com';
const response = await axios.get(
'https://api.mailodds.com/v1/dmarc/domains/' + domain + '/trend',
{ headers: { 'Authorization': 'Bearer ' + process.env.MAILODDS_API_KEY } }
);
const trend = response.data;
const latest = trend.data_points[trend.data_points.length - 1];
callback({
outputFields: {
domain: trend.domain,
policy: trend.policy,
fail_percentage: latest ? latest.fail_percentage : 0,
spf_pass: latest ? latest.spf_pass_count : 0,
dkim_pass: latest ? latest.dkim_pass_count : 0,
alert_needed: latest && latest.fail_percentage > 5
}
});
};
// Trigger: scheduled workflow (daily)
// If alert_needed: send Slack notification or create HubSpot task Related: DMARC Monitoring
Pull recent campaign performance from MailOdds and surface it in HubSpot. Write open rates, click rates, and delivery counts to custom properties or use them in workflow branching logic.
// HubSpot Custom Code Action - Sync Campaign Analytics
const axios = require('axios');
exports.main = async (event, callback) => {
// Fetch recent campaign performance from MailOdds
const response = await axios.get('https://api.mailodds.com/v1/campaigns', {
headers: { 'Authorization': 'Bearer ' + process.env.MAILODDS_API_KEY },
params: { limit: 5, sort: '-created_at' }
});
const campaigns = response.data;
const summary = campaigns.map(c => ({
name: c.name,
sent: c.stats.sent,
delivered: c.stats.delivered,
opens: c.stats.unique_opens,
clicks: c.stats.unique_clicks
}));
callback({
outputFields: {
campaign_count: summary.length,
latest_campaign: summary[0] ? summary[0].name : 'none',
latest_open_rate: summary[0] ? ((summary[0].opens / summary[0].delivered) * 100).toFixed(1) + '%' : '0%',
campaigns_json: JSON.stringify(summary)
}
});
}; Related: Email Campaigns
Identify contacts who have not engaged in a configurable time window. Use this in a monthly workflow to trigger re-engagement campaigns or flag stale contacts for removal from active lists.
// HubSpot Custom Code Action - Find Inactive Contacts
const axios = require('axios');
exports.main = async (event, callback) => {
const response = await axios.get(
'https://api.mailodds.com/v1/contacts/inactive-report',
{
headers: { 'Authorization': 'Bearer ' + process.env.MAILODDS_API_KEY },
params: { days: 90 }
}
);
const report = response.data;
callback({
outputFields: {
inactive_count: report.inactive_count,
total_contacts: report.total_contacts,
inactive_percentage: report.inactive_percentage,
recommendation: report.inactive_percentage > 20
? 'Consider re-engagement campaign or list cleanup'
: 'Engagement levels healthy'
}
});
};
// Use in monthly workflow to flag contacts for re-engagement or removal Related: Email Deliverability Platform
Can't find what you're looking for? We're here to help you get HubSpot working.
Get 1,000 free validations and start verifying HubSpot contacts today.