AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
import type { MauticRecord } from './types';
function contactSampleData({ eventType }: { eventType: string }): Record<string, unknown> {
return { [eventType]: [CONTACT_SAMPLE] };
}
function toBatchRecords({ records }: { records: unknown[] }): MauticRecord[] {
if (records.length === 0) {
throw new Error('Records must contain at least one record.');
}
return records.map((record, index) => {
if (typeof record !== 'object' || record === null || Array.isArray(record)) {
throw new Error(`Records item ${index + 1} must be an object of field values.`);
}
return Object.fromEntries(Object.entries(record));
});
}
function toBatchIds({ ids }: { ids: unknown[] }): string[] {
if (ids.length === 0) {
throw new Error('Give at least one id.');
}
return ids.map(String);
}
export const mauticUtils = { contactSampleData, toBatchRecords, toBatchIds };
const CONTACT_SAMPLE = {
contact: {
id: 38186,
points: 0,
color: null,
fields: {
core: {
points: {
id: '9',
label: 'Points',
alias: 'points',
type: 'number',
group: 'core',
object: 'lead',
is_fixed: '1',
value: '0',
},
title: {
id: '1',
label: 'Title',
alias: 'title',
type: 'lookup',
group: 'core',
object: 'lead',
is_fixed: '1',
value: '',
},
firstname: {
id: '2',
label: 'First Name',
alias: 'firstname',
type: 'text',
group: 'core',
object: 'lead',
is_fixed: '1',
value: 'Test',
},
lastname: {
id: '3',
label: 'Last Name',
alias: 'lastname',
type: 'text',
group: 'core',
object: 'lead',
is_fixed: '1',
value: 'Contact',
},
company: {
id: '4',
label: 'Company',
alias: 'company',
type: 'text',
group: 'core',
object: 'lead',
is_fixed: '1',
value: '',
},
position: {
id: '5',
label: 'Position',
alias: 'position',
type: 'text',
group: 'core',
object: 'lead',
is_fixed: '1',
value: '',
},
email: {
id: '6',
label: 'Email',
alias: 'email',
type: 'email',
group: 'core',
object: 'lead',
is_fixed: '1',
value: '[email protected]',
},
phone: {
id: '8',
label: 'Phone',
alias: 'phone',
type: 'tel',
group: 'core',
object: 'lead',
is_fixed: '1',
value: '',
},
mobile: {
id: '7',
label: 'Mobile',
alias: 'mobile',
type: 'tel',
group: 'core',
object: 'lead',
is_fixed: '1',
value: '',
},
address1: {
id: '11',
label: 'Address Line 1',
alias: 'address1',
type: 'text',
group: 'core',
object: 'lead',
is_fixed: '1',
value: '',
},
address2: {
id: '12',
label: 'Address Line 2',
alias: 'address2',
type: 'text',
group: 'core',
object: 'lead',
is_fixed: '1',
value: '',
},
city: {
id: '13',
label: 'City',
alias: 'city',
type: 'text',
group: 'core',
object: 'lead',
is_fixed: '1',
value: '',
},
state: {
id: '14',
label: 'State',
alias: 'state',
type: 'region',
group: 'core',
object: 'lead',
is_fixed: '1',
value: '',
},
zipcode: {
id: '15',
label: 'Zip Code',
alias: 'zipcode',
type: 'text',
group: 'core',
object: 'lead',
is_fixed: '1',
value: '',
},
country: {
id: '16',
label: 'Country',
alias: 'country',
type: 'country',
group: 'core',
object: 'lead',
is_fixed: '1',
value: '',
},
fax: {
id: '10',
label: 'Fax',
alias: 'fax',
type: 'tel',
group: 'core',
object: 'lead',
is_fixed: '0',
value: null,
},
preferred_locale: {
id: '17',
label: 'Preferred Locale',
alias: 'preferred_locale',
type: 'locale',
group: 'core',
object: 'lead',
is_fixed: '1',
value: null,
},
attribution_date: {
id: '18',
label: 'Attribution Date',
alias: 'attribution_date',
type: 'datetime',
group: 'core',
object: 'lead',
is_fixed: '1',
value: null,
},
attribution: {
id: '19',
label: 'Attribution',
alias: 'attribution',
type: 'number',
group: 'core',
object: 'lead',
is_fixed: '1',
value: null,
},
website: {
id: '20',
label: 'Website',
alias: 'website',
type: 'url',
group: 'core',
object: 'lead',
is_fixed: '0',
value: null,
},
boolean: {
id: '43',
label: 'Boolean',
alias: 'boolean',
type: 'boolean',
group: 'core',
object: 'lead',
is_fixed: '0',
value: null,
},
multiple_contact: {
id: '44',
label: 'Multiple Contact',
alias: 'multiple_contact',
type: 'multiselect',
group: 'core',
object: 'lead',
is_fixed: '0',
value: null,
},
},
social: {
facebook: {
id: '21',
label: 'Facebook',
alias: 'facebook',
type: 'text',
group: 'social',
object: 'lead',
is_fixed: '0',
value: null,
},
foursquare: {
id: '22',
label: 'Foursquare',
alias: 'foursquare',
type: 'text',
group: 'social',
object: 'lead',
is_fixed: '0',
value: null,
},
instagram: {
id: '24',
label: 'Instagram',
alias: 'instagram',
type: 'text',
group: 'social',
object: 'lead',
is_fixed: '0',
value: null,
},
linkedin: {
id: '25',
label: 'LinkedIn',
alias: 'linkedin',
type: 'text',
group: 'social',
object: 'lead',
is_fixed: '0',
value: null,
},
skype: {
id: '26',
label: 'Skype',
alias: 'skype',
type: 'text',
group: 'social',
object: 'lead',
is_fixed: '0',
value: null,
},
twitter: {
id: '27',
label: 'Twitter',
alias: 'twitter',
type: 'text',
group: 'social',
object: 'lead',
is_fixed: '0',
value: null,
},
},
personal: [],
professional: [],
},
},
channel: 'email',
old_status: 'contactable',
new_status: 'manual',
timestamp: '2017-12-01T00:05:18-06:00',
};