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 { staticListsDropdown } from '../common/props';
import { createAction, Property } from '@activepieces/pieces-framework';
import { getHubspotAccessToken, hubspotAuth } from '../auth';
import { AuthenticationType, httpClient, HttpMethod } from '@activepieces/pieces-common';
export const hubSpotListsAddContactAction = createAction({
auth: hubspotAuth,
name: 'add_contact_to_list',
classification: 'WRITE',
displayName: 'Add Contact to List',
description: 'Adds a contact to a static list by email.',
audience: 'both',
aiMetadata: { description: 'Adds a contact, identified by email, to a chosen HubSpot static contact list. Use to enroll a known contact into a list for segmentation or workflow targeting; the list must be static (not dynamic/active). Idempotent: a contact already on the list stays a single member.', idempotent: true },
propertyGroups: [
{
key: 'list',
display: 'section',
label: 'List',
icon: 'users',
props: ['listId'],
},
{
key: 'contact',
display: 'section',
label: 'Contact',
icon: 'user',
props: ['email'],
},
],
props: {
listId: staticListsDropdown,
email: Property.ShortText({
displayName: 'Contact Email',
placeholder: '[email protected]',
required: true,
}),
},
async run(context) {
const { listId, email } = context.propsValue;
const response = await httpClient.sendRequest({
method: HttpMethod.POST,
url: `https://api.hubapi.com/contacts/v1/lists/${listId}/add`,
body: {
emails: [email],
},
authentication: {
type: AuthenticationType.BEARER_TOKEN,
token: getHubspotAccessToken(context.auth),
},
})
return response.body;
},
});