Back to Integrations

HubSpot Integration

Marketing

Enhance marketing assets in HubSpot

Email Images

Optimize for campaigns

Landing Pages

Enhance hero images

Social Content

Create variations

HubSpot Workflow Integration

Custom Workflow Action
// HubSpot Custom Workflow Action (Node.js)
const hubspot = require('@hubspot/api-client');

exports.main = async (event) => {
  const { image_url, process_type } = event.inputFields;
  
  // Map process types to ButterflyAPI endpoints
  const apiMap = {
    'enhance': 'image-enhance',
    'remove_bg': 'background-remove',
    'cartoon': 'cartoon'
  };
  
  const response = await fetch('https://butterflyapi.com/api/v1/run', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_BUTTERFLY_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      api: apiMap[process_type] || 'image-enhance',
      input: { image_url }
    })
  });
  
  const result = await response.json();
  
  return {
    outputFields: {
      processed_image_url: result.output.image_url,
      credits_used: result.credits_used
    }
  };
};