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 { TriggerStrategy, createTrigger } from '@activepieces/pieces-framework';
import { ghostAuth } from '../auth';
import { ghostWebhook } from '../common/webhooks';
import { ghostPostPublishedTriggerOutputSchema } from '../output-schemas';
export const postPublished = createTrigger({
auth: ghostAuth,
name: 'post_published',
outputSchema: ghostPostPublishedTriggerOutputSchema,
classification: 'READ',
displayName: 'Post Published',
description: 'Triggers when a post is published',
aiMetadata: {
description: 'Fires when a post is published in the Ghost publication (post.published), i.e. a post transitions to published status and goes live. Payload carries the published post record.',
},
type: TriggerStrategy.WEBHOOK,
props: {},
async onEnable(context) {
await ghostWebhook.enable({
auth: context.auth,
event: 'post.published',
webhookUrl: context.webhookUrl,
store: context.store,
storeKey: '_post_published_trigger',
});
},
async onDisable(context) {
await ghostWebhook.disable({ auth: context.auth, store: context.store, storeKey: '_post_published_trigger' });
},
async run(context) {
await ghostWebhook.assertSigned({
store: context.store,
storeKey: '_post_published_trigger',
rawBody: context.payload.rawBody,
headers: context.payload.headers,
});
return [context.payload.body];
},
sampleData: {
post: {
current: {
id: '64be83c424cb9a0001f49f1d',
url: 'https://test-publication.ghost.io/test-post/',
html: '<p>Hello my friends</p><p></p><p>this is testing</p>',
slug: 'test-post',
tags: [],
uuid: '77afb2c2-af1a-4a7f-bebc-fa1e314579d0',
count: {
clicks: 0,
negative_feedback: 0,
positive_feedback: 0,
},
tiers: [
{
id: '64be4f5a03946b00098ef8f4',
name: 'Free',
slug: 'free',
type: 'free',
active: true,
currency: null,
created_at: '2023-07-24T10:15:54.000Z',
trial_days: 0,
updated_at: '2023-07-24T10:15:54.000Z',
visibility: 'public',
description: null,
yearly_price: null,
monthly_price: null,
yearly_price_id: null,
monthly_price_id: null,
welcome_page_url: null,
},
{
id: '64be4f5a03946b00098ef8f5',
name: 'Test Publication',
slug: 'default-product',
type: 'paid',
active: true,
currency: 'usd',
created_at: '2023-07-24T10:15:54.000Z',
trial_days: 0,
updated_at: '2023-07-24T10:15:54.000Z',
visibility: 'public',
description: null,
yearly_price: 5000,
monthly_price: 500,
yearly_price_id: null,
monthly_price_id: null,
welcome_page_url: null,
},
],
title: 'Test Post',
status: 'published',
authors: [
{
id: '1',
bio: null,
url: 'https://test-publication.ghost.io/author/slug/',
name: 'First Last',
slug: 'slug',
tour: null,
email: '[email protected]',
roles: [
{
id: '64be4f5903946b00098ef8eb',
name: 'Owner',
created_at: '2023-07-24T10:15:53.000Z',
updated_at: '2023-07-24T10:15:53.000Z',
description: 'Blog Owner',
},
],
status: 'active',
twitter: null,
website: null,
facebook: null,
location: null,
last_seen: '2023-07-24T13:05:18.000Z',
created_at: '2023-07-24T10:15:53.000Z',
meta_title: null,
updated_at: '2023-07-24T13:05:18.000Z',
cover_image: null,
accessibility: '{"nightShift":true}',
profile_image:
'https://www.gravatar.com/avatar/123123123?s=250&r=x&d=mp',
meta_description: null,
comment_notifications: true,
mention_notifications: true,
milestone_notifications: true,
free_member_signup_notification: true,
paid_subscription_started_notification: true,
paid_subscription_canceled_notification: false,
},
],
excerpt: 'Hello my friends\n\n\n\nthis is testing',
featured: false,
og_image: null,
og_title: null,
mobiledoc:
'{"version":"0.3.1","atoms":[],"cards":[],"markups":[],"sections":[[1,"p",[[0,[],0,"Hello my friends"]]],[1,"p",[]],[1,"p",[[0,[],0,"this is testing"]]]],"ghostVersion":"4.0"}',
plaintext: 'Hello my friends\n\n\n\nthis is testing',
comment_id: '64be83c424cb9a0001f49f1d',
created_at: '2023-07-24T13:59:32.000Z',
email_only: false,
meta_title: null,
updated_at: '2023-07-24T13:59:43.000Z',
visibility: 'public',
frontmatter: null,
primary_tag: null,
published_at: '2023-07-24T13:59:43.000Z',
reading_time: 0,
canonical_url: null,
email_segment: 'all',
email_subject: null,
feature_image: null,
twitter_image: null,
twitter_title: null,
custom_excerpt: null,
og_description: null,
post_revisions: [],
primary_author: {
id: '1',
bio: null,
url: 'https://test-publication.ghost.io/author/slug/',
name: 'First Last',
slug: 'slug',
tour: null,
email: '[email protected]',
roles: [
{
id: '64be4f5903946b00098ef8eb',
name: 'Owner',
created_at: '2023-07-24T10:15:53.000Z',
updated_at: '2023-07-24T10:15:53.000Z',
description: 'Blog Owner',
},
],
status: 'active',
twitter: null,
website: null,
facebook: null,
location: null,
last_seen: '2023-07-24T13:05:18.000Z',
created_at: '2023-07-24T10:15:53.000Z',
meta_title: null,
updated_at: '2023-07-24T13:05:18.000Z',
cover_image: null,
accessibility: '{"nightShift":true}',
profile_image:
'https://www.gravatar.com/avatar/123123123?s=250&r=x&d=mp',
meta_description: null,
comment_notifications: true,
mention_notifications: true,
milestone_notifications: true,
free_member_signup_notification: true,
paid_subscription_started_notification: true,
paid_subscription_canceled_notification: false,
},
custom_template: null,
meta_description: null,
feature_image_alt: null,
codeinjection_foot: null,
codeinjection_head: null,
twitter_description: null,
feature_image_caption: null,
},
previous: {
status: 'draft',
updated_at: '2023-07-24T13:59:39.000Z',
published_at: null,
},
},
},
});