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 { createAction, Property } from '@activepieces/pieces-framework';
import { HttpMethod, httpClient } from '@activepieces/pieces-common';
import { ghostAuth } from '../auth';
import { common } from '../common';
import { ghostOriginalMembersOutputSchema } from '../output-schemas';
export const updateMember = createAction({
name: 'update_member',
outputSchema: ghostOriginalMembersOutputSchema,
classification: 'WRITE',
displayName: 'Update Member',
description: 'Update a member',
audience: 'human',
aiMetadata: { description: 'Updates an existing Ghost member identified by member id, changing any supplied fields (email, name, note, newsletter subscriptions); omitted fields are left unchanged. Use to edit a known member. Requires the target member id. Idempotent: re-applying the same field values yields the same member state.', idempotent: true },
auth: ghostAuth,
props: {
member: common.properties.member(),
email: Property.ShortText({
displayName: 'Email',
required: false,
}),
name: Property.ShortText({
displayName: 'Full Name',
required: false,
}),
note: Property.ShortText({
displayName: 'Note',
required: false,
}),
newsletters: common.properties.newsletters(false),
},
async run(context) {
const newsletters: any[] = [];
if (context.propsValue.newsletters) {
context.propsValue.newsletters.forEach((newsletter: any) => {
newsletters.push({
id: newsletter,
});
});
}
const data: {
email?: string;
name?: string;
note?: string;
newsletters?: any[];
} = {};
if (context.propsValue.email) data.email = context.propsValue.email;
if (context.propsValue.name) data.name = context.propsValue.name;
if (context.propsValue.note) data.note = context.propsValue.note;
if (context.propsValue.newsletters)
data.newsletters = newsletters;
const response = await httpClient.sendRequest({
url: `${context.auth.props.baseUrl}/ghost/api/admin/members/${context.propsValue.member}`,
method: HttpMethod.PUT,
headers: {
Authorization: `Ghost ${common.jwtFromApiKey(context.auth.props.apiKey)}`,
},
body: {
members: [data],
},
});
return response.body;
},
});