Skip to content

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

feat(sendfox): let AI agents manage contacts and read lists, campaigns and forms (#17071)

Kishan Parmare5c3c7d41b30
diff --git a/bun.lock b/bun.lock
index 79eb784454a..630e1e3568e 100644
--- a/bun.lock
+++ b/bun.lock
@@ -8294,7 +8294,7 @@
},
"packages/pieces/community/sendfox": {
"name": "@activepieces/piece-sendfox",
- "version": "0.3.0",
+ "version": "0.4.0",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
diff --git a/packages/pieces/community/sendfox/package.json b/packages/pieces/community/sendfox/package.json
index 624d03861ca..6a10932f9ce 100644
--- a/packages/pieces/community/sendfox/package.json
+++ b/packages/pieces/community/sendfox/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-sendfox",
- "version": "0.3.0",
+ "version": "0.4.0",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
diff --git a/packages/pieces/community/sendfox/src/common/index.ts b/packages/pieces/community/sendfox/src/common/index.ts
deleted file mode 100644
index 81ce1d066d7..00000000000
--- a/packages/pieces/community/sendfox/src/common/index.ts
+++ /dev/null
@@ -1,130 +0,0 @@
-import { Property, OAuth2PropertyValue } from '@activepieces/pieces-framework';
-import {
- HttpMethod,
- HttpMessageBody,
- HttpResponse,
- httpClient,
- AuthenticationType,
-} from '@activepieces/pieces-common';
-import { sendfoxAuth } from '../lib/auth';
-
-export async function getLists(accessToken: string) {
- const list_of_lists = [];
- let last_page = 1;
- for (let i = 1; i <= last_page; i++) {
- const response = (
- await callsendfoxApi<{
- current_page: number;
- data: {
- id: number;
- name: string;
- }[];
- last_page: number;
- }>(HttpMethod.GET, `lists?page=${i}`, accessToken, undefined)
- ).body;
- last_page = response.last_page;
- const lists = response.data;
- list_of_lists.push(lists);
- }
- return list_of_lists;
-}
-export async function getcontacts(accessToken: string) {
- let list_of_contacts = [];
- let last_page = 1;
- for (let i = 1; i <= last_page; i++) {
- const response = (
- await callsendfoxApi<{
- current_page: number;
- data: {
- id: number;
- first_name: string;
- last_name: string;
- }[];
- last_page: number;
- }>(HttpMethod.GET, `contacts?page=${i}`, accessToken, undefined)
- ).body;
- last_page = response.last_page;
- const contacts = response.data;
- list_of_contacts.push(contacts);
- }
-
- // convert the list of contacts to have name as first_name+last_name
- list_of_contacts = list_of_contacts.flat().map((contact) => {
- return {
- id: contact.id,
- name: contact.first_name + ' ' + contact.last_name,
- };
- });
- return list_of_contacts;
-}
-
-export const sendfoxCommon = {
- baseUrl: 'https://api.sendfox.com',
- lists: Property.Dropdown({
- auth: sendfoxAuth,
- displayName: 'List',
- description: 'Leave empty to add the contact without a list.',
- required: false,
- refreshers: ['auth'],
- options: async ({ auth }) => {
- if (!auth) {
- return {
- disabled: true,
- placeholder: 'Please connect your account first',
- options: [],
- };
- }
- const authentication = auth.secret_text;
- if (!authentication) {
- return {
- disabled: true,
- placeholder: 'Please connect your account first',
- options: [],
- };
- }
- const accessToken = authentication;
- try {
- const lists = (await getLists(accessToken)).flat();
- if (lists.length === 0) {
- return {
- disabled: false,
- placeholder: 'No lists found. Create one in SendFox first.',
- options: [],
- };
- }
- return {
- disabled: false,
- options: lists.map((list) => {
- return {
- label: list.name,
- value: list.id,
- };
- }),
- };
- } catch {
- return {
- disabled: true,
- placeholder: 'Failed to load lists. Check your connection.',
- options: [],
- };
- }
- },
- }),
-};
-
-export async function callsendfoxApi<T extends HttpMessageBody>(
- method: HttpMethod,
- apiUrl: string,
- accessToken: string,
- body: any | undefined
-): Promise<HttpResponse<T>> {
- return await httpClient.sendRequest<T>({
- method: method,
- url: `${sendfoxCommon.baseUrl}/${apiUrl}`,
- authentication: {
- type: AuthenticationType.BEARER_TOKEN,
- token: accessToken,
- },
- body: body,
- });
-}
diff --git a/packages/pieces/community/sendfox/src/index.ts b/packages/pieces/community/sendfox/src/index.ts
index 4bf3b92232f..c3a95ab18ce 100644
--- a/packages/pieces/community/sendfox/src/index.ts
+++ b/packages/pieces/community/sendfox/src/index.ts
@@ -1,11 +1,12 @@
import { createCustomApiCallAction } from '@activepieces/pieces-common';
-import { createPiece, PieceAuth } from '@activepieces/pieces-framework';
-import { PieceCategory } from '@activepieces/pieces-framework';
-import { createContact } from './lib/actions/create-contact';
-import { createList } from './lib/actions/create-list';
-import { unsubscribe } from './lib/actions/unsubscribe-contact';
+import { createPiece, PieceCategory } from '@activepieces/pieces-framework';
+import { createContactAction } from './lib/actions/create-contact';
+import { createListAction } from './lib/actions/create-list';
+import { sendfoxAiActions } from './lib/actions/ai';
+import { unsubscribeContactAction } from './lib/actions/unsubscribe-contact';
import { sendfoxAuth } from './lib/auth';
-import { sendfoxCommon } from './common';
+import { sendfoxClient } from './lib/common/client';
+
export const sendfox = createPiece({
displayName: 'SendFox',
description: 'Email marketing made simple',
@@ -14,20 +15,21 @@ export const sendfox = createPiece({
minimumSupportedRelease: '0.88.2',
logoUrl: 'https://cdn.activepieces.com/pieces/sendfox.png',
categories: [PieceCategory.MARKETING],
- authors: ["Salem-Alaa","kishanprmr","MoShizzle","abuaboud"],
+ authors: ['Salem-Alaa', 'kishanprmr', 'MoShizzle', 'abuaboud'],
actions: [
- createList,
- unsubscribe,
- createContact,
+ createListAction,
+ unsubscribeContactAction,
+ createContactAction,
+ ...sendfoxAiActions,
createCustomApiCallAction({
- baseUrl: () => sendfoxCommon.baseUrl,
+ baseUrl: () => sendfoxClient.baseUrl(),
auth: sendfoxAuth,
authMapping: async (auth) => ({
Authorization: `Bearer ${auth.secret_text}`,
}),
props: {
url: {
- description: `Full URL, or a path relative to ${sendfoxCommon.baseUrl}`,
+ description: `Full URL, or a path relative to ${sendfoxClient.baseUrl()}`,
placeholder: '/contacts',
},
},
diff --git a/packages/pieces/community/sendfox/src/lib/actions/ai/automations/get-automation.ts b/packages/pieces/community/sendfox/src/lib/actions/ai/automations/get-automation.ts
new file mode 100644
index 00000000000..1f0ec75f53c
--- /dev/null
+++ b/packages/pieces/community/sendfox/src/lib/actions/ai/automations/get-automation.ts
@@ -0,0 +1,35 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { sendfoxAuth } from '../../../auth';
+import { sendfoxClient } from '../../../common/client';
+import { sendfoxGetAutomationOutputSchema } from '../../../output-schemas';
+
+export const getAutomationAction = createAction({
+ auth: sendfoxAuth,
+ name: 'sendfox_get_automation',
+ outputSchema: sendfoxGetAutomationOutputSchema,
+ displayName: 'Get Automation',
+ description: 'Get one SendFox automation',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Returns one automation by ID with its title, active state, triggers and steps. Automation IDs come from List Automations.',
+ idempotent: true,
+ },
+ props: {
+ automationId: Property.ShortText({
+ displayName: 'Automation ID',
+ description: 'ID of an automation, e.g. "9876". Use List Automations to find it.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { propsValue } = context;
+ return await sendfoxClient.request<unknown>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ path: `/automations/${encodeURIComponent(propsValue.automationId)}`,
+ });
+ },
+});
diff --git a/packages/pieces/community/sendfox/src/lib/actions/ai/automations/list-automations.ts b/packages/pieces/community/sendfox/src/lib/actions/ai/automations/list-automations.ts
new file mode 100644
index 00000000000..941389d587c
--- /dev/null
+++ b/packages/pieces/community/sendfox/src/lib/actions/ai/automations/list-automations.ts
@@ -0,0 +1,35 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { sendfoxAuth } from '../../../auth';
+import { sendfoxAiProps } from '../../../common/ai-props';
+import { sendfoxClient } from '../../../common/client';
+import { sendfoxListAutomationsOutputSchema } from '../../../output-schemas';
+
+export const listAutomationsAction = createAction({
+ auth: sendfoxAuth,
+ name: 'sendfox_list_automations',
+ outputSchema: sendfoxListAutomationsOutputSchema,
+ displayName: 'List Automations',
+ description: 'List the automations in your SendFox account',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Returns one page of automations with their IDs, titles and active state. Use it to find an automation ID for Get Automation.',
+ idempotent: true,
+ },
+ props: {
+ page: sendfoxAiProps.page({ required: false }),
+ },
+ async run(context) {
+ const { propsValue } = context;
+ return await sendfoxClient.request<unknown>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ path: '/automations',
+ query: {
+ ...(propsValue.page !== undefined ? { page: String(propsValue.page) } : {}),
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/sendfox/src/lib/actions/ai/campaigns/get-campaign-stats.ts b/packages/pieces/community/sendfox/src/lib/actions/ai/campaigns/get-campaign-stats.ts
new file mode 100644
index 00000000000..babd7a6cfa8
--- /dev/null
+++ b/packages/pieces/community/sendfox/src/lib/actions/ai/campaigns/get-campaign-stats.ts
@@ -0,0 +1,52 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { sendfoxAuth } from '../../../auth';
+import { sendfoxAiProps } from '../../../common/ai-props';
+import { sendfoxClient } from '../../../common/client';
+import { sendfoxGetCampaignStatsOutputSchema } from '../../../output-schemas';
+
+const BOOLEAN_OPTIONS = [
+ { label: 'Yes', value: 'true' },
+ { label: 'No', value: 'false' },
+];
+
+export const getCampaignStatsAction = createAction({
+ auth: sendfoxAuth,
+ name: 'sendfox_get_campaign_stats',
+ outputSchema: sendfoxGetCampaignStatsOutputSchema,
+ displayName: 'Get Campaign Stats',
+ description: 'Get performance stats for one SendFox campaign',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Returns one campaign\'s sent, open, click, unsubscribe, bounce and spam counts and rates, and optionally clicks per link. Use List Campaign Stats for several campaigns at once. Campaign IDs come from List Campaigns.',
+ idempotent: true,
+ },
+ props: {
+ campaignId: sendfoxAiProps.campaignId({ required: true }),
+ includeLinkStats: Property.StaticDropdown({
+ displayName: 'Include Link Stats',
+ description: '"true" adds clicks per link. Leave empty for SendFox\'s default.',
+ required: false,
+ options: { options: BOOLEAN_OPTIONS },
+ }),
+ linkLimit: Property.Number({
+ displayName: 'Link Limit',
+ description: 'Most links to include in the link stats.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { campaignId, includeLinkStats, linkLimit } = context.propsValue;
+ return await sendfoxClient.request<unknown>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ path: `/campaigns/${encodeURIComponent(campaignId)}/stats`,
+ query: {
+ ...(includeLinkStats ? { include_link_stats: includeLinkStats } : {}),
+ ...(linkLimit !== undefined ? { link_limit: String(linkLimit) } : {}),
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/sendfox/src/lib/actions/ai/campaigns/get-campaign.ts b/packages/pieces/community/sendfox/src/lib/actions/ai/campaigns/get-campaign.ts
new file mode 100644
index 00000000000..2ca5fedf182
--- /dev/null
+++ b/packages/pieces/community/sendfox/src/lib/actions/ai/campaigns/get-campaign.ts
@@ -0,0 +1,32 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { sendfoxAuth } from '../../../auth';
+import { sendfoxAiProps } from '../../../common/ai-props';
+import { sendfoxClient } from '../../../common/client';
+import { sendfoxGetCampaignOutputSchema } from '../../../output-schemas';
+
+export const getCampaignAction = createAction({
+ auth: sendfoxAuth,
+ name: 'sendfox_get_campaign',
+ outputSchema: sendfoxGetCampaignOutputSchema,
+ displayName: 'Get Campaign',
+ description: 'Get one SendFox campaign',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Returns one campaign by ID with its title, subject, preview text, HTML, sender and scheduled and sent times. Campaign IDs come from List Campaigns.',
+ idempotent: true,
+ },
+ props: {
+ campaignId: sendfoxAiProps.campaignId({ required: true }),
+ },
+ async run(context) {
+ const { propsValue } = context;
+ return await sendfoxClient.request<unknown>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ path: `/campaigns/${encodeURIComponent(propsValue.campaignId)}`,
+ });
+ },
+});
diff --git a/packages/pieces/community/sendfox/src/lib/actions/ai/campaigns/list-campaign-stats.ts b/packages/pieces/community/sendfox/src/lib/actions/ai/campaigns/list-campaign-stats.ts
new file mode 100644
index 00000000000..721bc2475cb
--- /dev/null
+++ b/packages/pieces/community/sendfox/src/lib/actions/ai/campaigns/list-campaign-stats.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { sendfoxAuth } from '../../../auth';
+import { sendfoxClient } from '../../../common/client';
+import { sendfoxListCampaignStatsOutputSchema } from '../../../output-schemas';
+
+export const listCampaignStatsAction = createAction({
+ auth: sendfoxAuth,
+ name: 'sendfox_list_campaign_stats',
+ outputSchema: sendfoxListCampaignStatsOutputSchema,
+ displayName: 'List Campaign Stats',
+ description: 'Get performance stats for several SendFox campaigns at once',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Returns sent, open, click, unsubscribe, bounce and spam counts and rates for 1 to 100 campaigns in one call. Use Get Campaign Stats for one campaign with its per-link clicks. Campaign IDs come from List Campaigns.',
+ idempotent: true,
+ },
+ props: {
+ campaignIds: Property.Array({
+ displayName: 'Campaign IDs',
+ description: '1 to 100 campaign IDs, e.g. ["1234567"]. Use List Campaigns to find them.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const query = new URLSearchParams(
+ context.propsValue.campaignIds.map((id) => ['campaign_ids[]', String(id)])
+ );
+ return await sendfoxClient.request<unknown>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ path: `/campaigns/stats?${query.toString()}`,
+ });
+ },
+});
diff --git a/packages/pieces/community/sendfox/src/lib/actions/ai/campaigns/list-campaigns.ts b/packages/pieces/community/sendfox/src/lib/actions/ai/campaigns/list-campaigns.ts
new file mode 100644
index 00000000000..ad3e20f28b3
--- /dev/null
+++ b/packages/pieces/community/sendfox/src/lib/actions/ai/campaigns/list-campaigns.ts
@@ -0,0 +1,35 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { sendfoxAuth } from '../../../auth';
+import { sendfoxAiProps } from '../../../common/ai-props';
+import { sendfoxClient } from '../../../common/client';
+import { sendfoxListCampaignsOutputSchema } from '../../../output-schemas';
+
+export const listCampaignsAction = createAction({
+ auth: sendfoxAuth,
+ name: 'sendfox_list_campaigns',
+ outputSchema: sendfoxListCampaignsOutputSchema,
+ displayName: 'List Campaigns',
+ description: 'List the email campaigns in your SendFox account',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Returns one page of campaigns with their IDs, titles, subjects, senders and scheduled and sent times. Use it to find a campaign ID for Get Campaign or Get Campaign Stats.',
+ idempotent: true,
+ },
+ props: {
+ page: sendfoxAiProps.page({ required: false }),
+ },
+ async run(context) {
+ const { propsValue } = context;
+ return await sendfoxClient.request<unknown>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ path: '/campaigns',
+ query: {
+ ...(propsValue.page !== undefined ? { page: String(propsValue.page) } : {}),
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/sendfox/src/lib/actions/ai/contact-fields/get-contact-field.ts b/packages/pieces/community/sendfox/src/lib/actions/ai/contact-fields/get-contact-field.ts
new file mode 100644
index 00000000000..b4d93fb3c41
--- /dev/null
+++ b/packages/pieces/community/sendfox/src/lib/actions/ai/contact-fields/get-contact-field.ts
@@ -0,0 +1,35 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { sendfoxAuth } from '../../../auth';
+import { sendfoxClient } from '../../../common/client';
+import { sendfoxGetContactFieldOutputSchema } from '../../../output-schemas';
+
+export const getContactFieldAction = createAction({
+ auth: sendfoxAuth,
+ name: 'sendfox_get_contact_field',
+ outputSchema: sendfoxGetContactFieldOutputSchema,
+ displayName: 'Get Contact Field',
+ description: 'Get one SendFox custom contact field',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Returns one custom contact field by ID with its label, name and type. Field IDs come from List Contact Fields.',
+ idempotent: true,
+ },
+ props: {
+ fieldId: Property.ShortText({
+ displayName: 'Field ID',
+ description: 'ID of a custom contact field, e.g. "123". Use List Contact Fields to find it.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { propsValue } = context;
+ return await sendfoxClient.request<unknown>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ path: `/contact-fields/${encodeURIComponent(propsValue.fieldId)}`,
+ });
+ },
+});
diff --git a/packages/pieces/community/sendfox/src/lib/actions/ai/contact-fields/list-contact-fields.ts b/packages/pieces/community/sendfox/src/lib/actions/ai/contact-fields/list-contact-fields.ts
new file mode 100644
index 00000000000..d22a07cbd50
--- /dev/null
+++ b/packages/pieces/community/sendfox/src/lib/actions/ai/contact-fields/list-contact-fields.ts
@@ -0,0 +1,35 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { sendfoxAuth } from '../../../auth';
+import { sendfoxAiProps } from '../../../common/ai-props';
+import { sendfoxClient } from '../../../common/client';
+import { sendfoxListContactFieldsOutputSchema } from '../../../output-schemas';
+
+export const listContactFieldsAction = createAction({
+ auth: sendfoxAuth,
+ name: 'sendfox_list_contact_fields',
+ outputSchema: sendfoxListContactFieldsOutputSchema,
+ displayName: 'List Contact Fields',
+ description: 'List the custom contact fields in your SendFox account',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Returns one page of custom contact fields with their IDs, labels, names and types (text, number or date). Use the names as `contactFields` in Create Contact.',
+ idempotent: true,
+ },
+ props: {
+ page: sendfoxAiProps.page({ required: false }),
+ },
+ async run(context) {
+ const { propsValue } = context;
+ return await sendfoxClient.request<unknown>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ path: '/contact-fields',
+ query: {
+ ...(propsValue.page !== undefined ? { page: String(propsValue.page) } : {}),
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/sendfox/src/lib/actions/ai/contact-tags/add-tag-to-contact.ts b/packages/pieces/community/sendfox/src/lib/actions/ai/contact-tags/add-tag-to-contact.ts
new file mode 100644
index 00000000000..5bafffa9add
--- /dev/null
+++ b/packages/pieces/community/sendfox/src/lib/actions/ai/contact-tags/add-tag-to-contact.ts
@@ -0,0 +1,35 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { sendfoxAuth } from '../../../auth';
+import { sendfoxAiProps } from '../../../common/ai-props';
+import { sendfoxClient } from '../../../common/client';
+import type { SendfoxTag } from '../../../common/types';
+import { sendfoxAddTagToContactOutputSchema } from '../../../output-schemas';
+
+export const addTagToContactAction = createAction({
+ auth: sendfoxAuth,
+ name: 'sendfox_add_tag_to_contact',
+ outputSchema: sendfoxAddTagToContactOutputSchema,
+ displayName: 'Add Tag to Contact',
+ description: 'Tag a SendFox contact',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Attaches an existing tag to a contact and returns all of the contact\'s tags. Tagging a contact that already has the tag leaves it unchanged. Tag IDs come from List Tags; contact IDs from Create Contact.',
+ idempotent: true,
+ },
+ props: {
+ contactId: sendfoxAiProps.contactId({ required: true }),
+ tagId: sendfoxAiProps.tagId({ required: true }),
+ },
+ async run(context) {
+ const { contactId, tagId } = context.propsValue;
+ const tags = await sendfoxClient.request<SendfoxTag[]>({
+ auth: context.auth,
+ method: HttpMethod.POST,
+ path: `/contacts/${encodeURIComponent(contactId)}/tags/${encodeURIComponent(tagId)}`,
+ });
+ return { tags, count: tags.length };
+ },
+});
diff --git a/packages/pieces/community/sendfox/src/lib/actions/ai/contact-tags/get-tag.ts b/packages/pieces/community/sendfox/src/lib/actions/ai/contact-tags/get-tag.ts
new file mode 100644
index 00000000000..415bc113da1
--- /dev/null
+++ b/packages/pieces/community/sendfox/src/lib/actions/ai/contact-tags/get-tag.ts
@@ -0,0 +1,32 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { sendfoxAuth } from '../../../auth';
+import { sendfoxAiProps } from '../../../common/ai-props';
+import { sendfoxClient } from '../../../common/client';
+import { sendfoxGetTagOutputSchema } from '../../../output-schemas';
+
+export const getTagAction = createAction({
+ auth: sendfoxAuth,
+ name: 'sendfox_get_tag',
+ outputSchema: sendfoxGetTagOutputSchema,
+ displayName: 'Get Tag',
+ description: 'Get one SendFox contact tag',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Returns one contact tag by ID with its name, color and contact count. Tag IDs come from List Tags.',
+ idempotent: true,
+ },
+ props: {
+ tagId: sendfoxAiProps.tagId({ required: true }),
+ },
+ async run(context) {
+ const { propsValue } = context;
+ return await sendfoxClient.request<unknown>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ path: `/contact-tags/${encodeURIComponent(propsValue.tagId)}`,
+ });
+ },
+});
diff --git a/packages/pieces/community/sendfox/src/lib/actions/ai/contact-tags/list-tags.ts b/packages/pieces/community/sendfox/src/lib/actions/ai/contact-tags/list-tags.ts
new file mode 100644
index 00000000000..b8f79631284
--- /dev/null
+++ b/packages/pieces/community/sendfox/src/lib/actions/ai/contact-tags/list-tags.ts
@@ -0,0 +1,35 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { sendfoxAuth } from '../../../auth';
+import { sendfoxAiProps } from '../../../common/ai-props';
+import { sendfoxClient } from '../../../common/client';
+import { sendfoxListTagsOutputSchema } from '../../../output-schemas';
+
+export const listTagsAction = createAction({
+ auth: sendfoxAuth,
+ name: 'sendfox_list_tags',
+ outputSchema: sendfoxListTagsOutputSchema,
+ displayName: 'List Tags',
+ description: 'List the contact tags in your SendFox account',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Returns one page of contact tags with their IDs, names, colors and contact counts. Use it to find a tag ID for Get Tag or Add Tag to Contact.',
+ idempotent: true,
+ },
+ props: {
+ page: sendfoxAiProps.page({ required: false }),
+ },
+ async run(context) {
+ const { propsValue } = context;
+ return await sendfoxClient.request<unknown>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ path: '/contact-tags',
+ query: {
+ ...(propsValue.page !== undefined ? { page: String(propsValue.page) } : {}),
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/sendfox/src/lib/actions/ai/contacts/create-contact.ts b/packages/pieces/community/sendfox/src/lib/actions/ai/contacts/create-contact.ts
new file mode 100644
index 00000000000..77af75d7da4
--- /dev/null
+++ b/packages/pieces/community/sendfox/src/lib/actions/ai/contacts/create-contact.ts
@@ -0,0 +1,66 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { sendfoxAuth } from '../../../auth';
+import { sendfoxApi } from '../../../common/api';
+import { createContactOutputSchema } from '../../../output-schemas';
+
+export const createContactAiAction = createAction({
+ auth: sendfoxAuth,
+ name: 'sendfox_create_contact',
+ outputSchema: createContactOutputSchema,
+ displayName: 'Create Contact',
+ description: 'Add a contact to SendFox, optionally to lists',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Adds a contact by email, with optional first and last name, IP address, custom field values and lists to join. Returns the contact with its ID. Use Add Contact to List for a contact that already exists. List IDs come from List Lists; custom field names from List Contact Fields.',
+ idempotent: false,
+ },
+ props: {
+ email: Property.ShortText({
+ displayName: 'Email',
+ description: 'Email address of the contact, e.g. "[email protected]".',
+ required: true,
+ }),
+ firstName: Property.ShortText({
+ displayName: 'First Name',
+ required: false,
+ }),
+ lastName: Property.ShortText({
+ displayName: 'Last Name',
+ required: false,
+ }),
+ ipAddress: Property.ShortText({
+ displayName: 'IP Address',
+ description: 'IP address the contact signed up from, e.g. "203.0.113.7".',
+ required: false,
+ }),
+ listIds: Property.Array({
+ displayName: 'List IDs',
+ description: 'IDs of lists to add the contact to, e.g. ["123456"]. Use List Lists to find them. Leave empty to add the contact to no list.',
+ required: false,
+ }),
+ contactFields: Property.Array({
+ displayName: 'Custom Fields',
+ description: 'Values for custom contact fields. Each item has the field `name` (from List Contact Fields) and its `value`.',
+ required: false,
+ properties: {
+ name: Property.ShortText({ displayName: 'Field Name', required: true }),
+ value: Property.ShortText({ displayName: 'Value', required: true }),
+ },
+ }),
+ },
+ async run(context) {
+ const { email, firstName, lastName, ipAddress, listIds, contactFields } =
+ context.propsValue;
+ return await sendfoxApi.createContact({
+ auth: context.auth,
+ email,
+ firstName,
+ lastName,
+ ipAddress,
+ lists: listIds?.map((id) => String(id)),
+ contactFields,
+ });
+ },
+});
diff --git a/packages/pieces/community/sendfox/src/lib/actions/ai/content-library/list-campaign-sections.ts b/packages/pieces/community/sendfox/src/lib/actions/ai/content-library/list-campaign-sections.ts
new file mode 100644
index 00000000000..91fb765e354
--- /dev/null
+++ b/packages/pieces/community/sendfox/src/lib/actions/ai/content-library/list-campaign-sections.ts
@@ -0,0 +1,37 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { sendfoxAuth } from '../../../auth';
+import { sendfoxAiProps } from '../../../common/ai-props';
+import { sendfoxClient } from '../../../common/client';
+import { sendfoxListCampaignSectionsOutputSchema } from '../../../output-schemas';
+
+export const listCampaignSectionsAction = createAction({
+ auth: sendfoxAuth,
+ name: 'sendfox_list_campaign_sections',
+ outputSchema: sendfoxListCampaignSectionsOutputSchema,
+ displayName: 'List Campaign Sections',
+ description: 'List your saved SendFox campaign sections',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Returns one page (20 per page) of saved campaign sections with their IDs, names and HTML. Optionally filters by name.',
+ idempotent: true,
+ },
+ props: {
+ search: sendfoxAiProps.query({ required: false, description: 'Text to filter sections by name; SQL LIKE wildcards (%) work. Leave empty to return all.' }),
+ page: sendfoxAiProps.page({ required: false }),
+ },
+ async run(context) {
+ const { propsValue } = context;
+ return await sendfoxClient.request<unknown>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ path: '/campaign-sections',
+ query: {
+ ...(propsValue.search ? { q: propsValue.search } : {}),
+ ...(propsValue.page !== undefined ? { page: String(propsValue.page) } : {}),
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/sendfox/src/lib/actions/ai/content-library/list-campaign-templates.ts b/packages/pieces/community/sendfox/src/lib/actions/ai/content-library/list-campaign-templates.ts
new file mode 100644
index 00000000000..d4c4e701598
--- /dev/null
+++ b/packages/pieces/community/sendfox/src/lib/actions/ai/content-library/list-campaign-templates.ts
@@ -0,0 +1,37 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { sendfoxAuth } from '../../../auth';
+import { sendfoxAiProps } from '../../../common/ai-props';
+import { sendfoxClient } from '../../../common/client';
+import { sendfoxListCampaignTemplatesOutputSchema } from '../../../output-schemas';
+
+export const listCampaignTemplatesAction = createAction({
+ auth: sendfoxAuth,
+ name: 'sendfox_list_campaign_templates',
+ outputSchema: sendfoxListCampaignTemplatesOutputSchema,
+ displayName: 'List Campaign Templates',
+ description: 'List your saved SendFox campaign templates',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Returns one page (20 per page) of saved campaign templates with their IDs, names and HTML. Optionally filters by name.',
+ idempotent: true,
+ },
+ props: {
+ search: sendfoxAiProps.query({ required: false, description: 'Text to filter templates by name; SQL LIKE wildcards (%) work. Leave empty to return all.' }),
+ page: sendfoxAiProps.page({ required: false }),
+ },
+ async run(context) {
+ const { propsValue } = context;
+ return await sendfoxClient.request<unknown>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ path: '/campaign-templates',
+ query: {
+ ...(propsValue.search ? { q: propsValue.search } : {}),
+ ...(propsValue.page !== undefined ? { page: String(propsValue.page) } : {}),
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/sendfox/src/lib/actions/ai/forms/get-form.ts b/packages/pieces/community/sendfox/src/lib/actions/ai/forms/get-form.ts
new file mode 100644
index 00000000000..4702b89bd53
--- /dev/null
+++ b/packages/pieces/community/sendfox/src/lib/actions/ai/forms/get-form.ts
@@ -0,0 +1,35 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { sendfoxAuth } from '../../../auth';
+import { sendfoxClient } from '../../../common/client';
+import { sendfoxGetFormOutputSchema } from '../../../output-schemas';
+
+export const getFormAction = createAction({
+ auth: sendfoxAuth,
+ name: 'sendfox_get_form',
+ outputSchema: sendfoxGetFormOutputSchema,
+ displayName: 'Get Form',
+ description: 'Get one SendFox signup form',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Returns one signup form by ID with its title, URL, redirect URL, GDPR setting and the lists it adds contacts to. Form IDs come from List Forms.',
+ idempotent: true,
+ },
+ props: {
+ formId: Property.ShortText({
+ displayName: 'Form ID',
+ description: 'ID of a signup form, e.g. "54321". Use List Forms to find it.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { propsValue } = context;
+ return await sendfoxClient.request<unknown>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ path: `/forms/${encodeURIComponent(propsValue.formId)}`,
+ });
+ },
+});
diff --git a/packages/pieces/community/sendfox/src/lib/actions/ai/forms/list-forms.ts b/packages/pieces/community/sendfox/src/lib/actions/ai/forms/list-forms.ts
new file mode 100644
index 00000000000..d5bb5081eb6
--- /dev/null
+++ b/packages/pieces/community/sendfox/src/lib/actions/ai/forms/list-forms.ts
@@ -0,0 +1,37 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { sendfoxAuth } from '../../../auth';
+import { sendfoxAiProps } from '../../../common/ai-props';
+import { sendfoxClient } from '../../../common/client';
+import { sendfoxListFormsOutputSchema } from '../../../output-schemas';
+
+export const listFormsAction = createAction({
+ auth: sendfoxAuth,
+ name: 'sendfox_list_forms',
+ outputSchema: sendfoxListFormsOutputSchema,
+ displayName: 'List Forms',
+ description: 'List the signup forms in your SendFox account',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Returns one page of signup forms with their IDs, titles, URLs and redirect URLs. Optionally filters by a search term. Use it to find a form ID for Get Form.',
+ idempotent: true,
+ },
+ props: {
+ query: sendfoxAiProps.query({ required: false, description: 'Text to filter forms by title. Leave empty to return all forms.' }),
+ page: sendfoxAiProps.page({ required: false }),
+ },
+ async run(context) {
+ const { propsValue } = context;
+ return await sendfoxClient.request<unknown>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ path: '/forms',
+ query: {
+ ...(propsValue.query ? { query: propsValue.query } : {}),
+ ...(propsValue.page !== undefined ? { page: String(propsValue.page) } : {}),
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/sendfox/src/lib/actions/ai/index.ts b/packages/pieces/community/sendfox/src/lib/actions/ai/index.ts
new file mode 100644
index 00000000000..888abad5278
--- /dev/null
+++ b/packages/pieces/community/sendfox/src/lib/actions/ai/index.ts
@@ -0,0 +1,43 @@
+import { createContactAiAction } from './contacts/create-contact';
+import { addTagToContactAction } from './contact-tags/add-tag-to-contact';
+import { getTagAction } from './contact-tags/get-tag';
+import { listTagsAction } from './contact-tags/list-tags';
+import { getCampaignStatsAction } from './campaigns/get-campaign-stats';
+import { getCampaignAction } from './campaigns/get-campaign';
+import { listCampaignStatsAction } from './campaigns/list-campaign-stats';
+import { listCampaignsAction } from './campaigns/list-campaigns';
+import { getFormAction } from './forms/get-form';
+import { listFormsAction } from './forms/list-forms';
+import { getCurrentUserAction } from './users/get-current-user';
+import { listCampaignSectionsAction } from './content-library/list-campaign-sections';
+import { listCampaignTemplatesAction } from './content-library/list-campaign-templates';
+import { getContactFieldAction } from './contact-fields/get-contact-field';
+import { listContactFieldsAction } from './contact-fields/list-contact-fields';
+import { addContactToListAction } from './lists/add-contact-to-list';
+import { getListAction } from './lists/get-list';
+import { listListsAction } from './lists/list-lists';
+import { getAutomationAction } from './automations/get-automation';
+import { listAutomationsAction } from './automations/list-automations';
+
+export const sendfoxAiActions = [
+ createContactAiAction,
+ addTagToContactAction,
+ getTagAction,
+ listTagsAction,
+ getCampaignStatsAction,
+ getCampaignAction,
+ listCampaignStatsAction,
+ listCampaignsAction,
+ getFormAction,
+ listFormsAction,
+ getCurrentUserAction,
+ listCampaignSectionsAction,
+ listCampaignTemplatesAction,
+ getContactFieldAction,
+ listContactFieldsAction,
+ addContactToListAction,
+ getListAction,
+ listListsAction,
+ getAutomationAction,
+ listAutomationsAction,
+];
diff --git a/packages/pieces/community/sendfox/src/lib/actions/ai/lists/add-contact-to-list.ts b/packages/pieces/community/sendfox/src/lib/actions/ai/lists/add-contact-to-list.ts
new file mode 100644
index 00000000000..6a20d2b6eb8
--- /dev/null
+++ b/packages/pieces/community/sendfox/src/lib/actions/ai/lists/add-contact-to-list.ts
@@ -0,0 +1,34 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { sendfoxAuth } from '../../../auth';
+import { sendfoxAiProps } from '../../../common/ai-props';
+import { sendfoxClient } from '../../../common/client';
+import { sendfoxAddContactToListOutputSchema } from '../../../output-schemas';
+
+export const addContactToListAction = createAction({
+ auth: sendfoxAuth,
+ name: 'sendfox_add_contact_to_list',
+ outputSchema: sendfoxAddContactToListOutputSchema,
+ displayName: 'Add Contact to List',
+ description: 'Add an existing SendFox contact to a list',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Adds an existing contact to a list by contact ID and list ID. Use it for a contact that already exists; to add a new email, use Create Contact with its lists. Contact IDs come from Create Contact; list IDs from List Lists.',
+ idempotent: true,
+ },
+ props: {
+ listId: sendfoxAiProps.listId({ required: true }),
+ contactId: sendfoxAiProps.contactId({ required: true }),
+ },
+ async run(context) {
+ const { listId, contactId } = context.propsValue;
+ return await sendfoxClient.request<unknown>({
+ auth: context.auth,
+ method: HttpMethod.POST,
+ path: `/lists/${encodeURIComponent(listId)}/contacts`,
+ body: { contact_id: contactId },
+ });
+ },
+});
diff --git a/packages/pieces/community/sendfox/src/lib/actions/ai/lists/get-list.ts b/packages/pieces/community/sendfox/src/lib/actions/ai/lists/get-list.ts
new file mode 100644
index 00000000000..1f0021e7815
--- /dev/null
+++ b/packages/pieces/community/sendfox/src/lib/actions/ai/lists/get-list.ts
@@ -0,0 +1,32 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { sendfoxAuth } from '../../../auth';
+import { sendfoxAiProps } from '../../../common/ai-props';
+import { sendfoxClient } from '../../../common/client';
+import { sendfoxGetListOutputSchema } from '../../../output-schemas';
+
+export const getListAction = createAction({
+ auth: sendfoxAuth,
+ name: 'sendfox_get_list',
+ outputSchema: sendfoxGetListOutputSchema,
+ displayName: 'Get List',
+ description: 'Get one SendFox contact list',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Returns one contact list by ID with its name, subscriber and unsubscriber counts and average open and click rates. List IDs come from List Lists.',
+ idempotent: true,
+ },
+ props: {
+ listId: sendfoxAiProps.listId({ required: true }),
+ },
+ async run(context) {
+ const { propsValue } = context;
+ return await sendfoxClient.request<unknown>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ path: `/lists/${encodeURIComponent(propsValue.listId)}`,
+ });
+ },
+});
diff --git a/packages/pieces/community/sendfox/src/lib/actions/ai/lists/list-lists.ts b/packages/pieces/community/sendfox/src/lib/actions/ai/lists/list-lists.ts
new file mode 100644
index 00000000000..f11de8b9271
--- /dev/null
+++ b/packages/pieces/community/sendfox/src/lib/actions/ai/lists/list-lists.ts
@@ -0,0 +1,37 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { sendfoxAuth } from '../../../auth';
+import { sendfoxAiProps } from '../../../common/ai-props';
+import { sendfoxClient } from '../../../common/client';
+import { sendfoxListListsOutputSchema } from '../../../output-schemas';
+
+export const listListsAction = createAction({
+ auth: sendfoxAuth,
+ name: 'sendfox_list_lists',
+ outputSchema: sendfoxListListsOutputSchema,
+ displayName: 'List Lists',
+ description: 'List the contact lists in your SendFox account',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Returns one page of contact lists with their IDs, names and subscriber counts. Use it to find a list ID for Get List or Add Contact to List. Optionally filters by a search term.',
+ idempotent: true,
+ },
+ props: {
+ query: sendfoxAiProps.query({ required: false, description: 'Text to filter lists by name. Leave empty to return all lists.' }),
+ page: sendfoxAiProps.page({ required: false }),
+ },
+ async run(context) {
+ const { propsValue } = context;
+ return await sendfoxClient.request<unknown>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ path: '/lists',
+ query: {
+ ...(propsValue.query ? { query: propsValue.query } : {}),
+ ...(propsValue.page !== undefined ? { page: String(propsValue.page) } : {}),
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/sendfox/src/lib/actions/ai/users/get-current-user.ts b/packages/pieces/community/sendfox/src/lib/actions/ai/users/get-current-user.ts
new file mode 100644
index 00000000000..c4923a04f87
--- /dev/null
+++ b/packages/pieces/community/sendfox/src/lib/actions/ai/users/get-current-user.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { sendfoxAuth } from '../../../auth';
+import { sendfoxClient } from '../../../common/client';
+import { sendfoxGetCurrentUserOutputSchema } from '../../../output-schemas';
+
+export const getCurrentUserAction = createAction({
+ auth: sendfoxAuth,
+ name: 'sendfox_get_current_user',
+ outputSchema: sendfoxGetCurrentUserOutputSchema,
+ displayName: 'Get Current User',
+ description: 'Get the SendFox account the connection belongs to',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Returns the SendFox account behind this connection: its ID, name, email, country, timezone and language. Use it to check which account is connected.',
+ idempotent: true,
+ },
+ props: {
+ },
+ async run(context) {
+ return await sendfoxClient.request<unknown>({
+ auth: context.auth,
+ method: HttpMethod.GET,
+ path: '/me',
+ });
+ },
+});
diff --git a/packages/pieces/community/sendfox/src/lib/actions/create-contact.ts b/packages/pieces/community/sendfox/src/lib/actions/create-contact.ts
index d2111d87feb..1ab14125bd8 100644
--- a/packages/pieces/community/sendfox/src/lib/actions/create-contact.ts
+++ b/packages/pieces/community/sendfox/src/lib/actions/create-contact.ts
@@ -1,15 +1,17 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { sendfoxAuth } from '../auth';
-import { callsendfoxApi, sendfoxCommon } from '../../common';
-import { HttpMethod } from '@activepieces/pieces-common';
+import { sendfoxApi } from '../common/api';
+import { sendfoxProps } from '../common/props';
+import { createContactOutputSchema } from '../output-schemas';
-export const createContact = createAction({
+export const createContactAction = createAction({
name: 'create-contact',
+ outputSchema: createContactOutputSchema,
classification: 'WRITE',
auth: sendfoxAuth,
displayName: 'Create Contact',
description: 'Add a contact to SendFox, optionally to one of your lists',
- audience: 'both',
+ audience: 'human',
aiMetadata: { description: 'Adds a new contact (subscriber) to SendFox by email, optionally setting first/last name and assigning the contact to a list. Use to add or onboard a subscriber. Not idempotent: each call posts the contact, so repeating may create or re-add the entry.', idempotent: false },
propertyGroups: [
{
@@ -45,29 +47,19 @@ export const createContact = createAction({
placeholder: 'Doe',
width: 'half',
}),
- list: sendfoxCommon.lists,
+ list: sendfoxProps.list({
+ required: false,
+ description: 'Leave empty to add the contact without a list.',
+ }),
},
async run(context) {
- const authentication = context.auth;
- const accessToken = authentication.secret_text;
- const email = context.propsValue.email;
- const firstname = context.propsValue.firstname;
- const lastname = context.propsValue.lastname;
- const list = context.propsValue.list;
-
- const request_body: { [key: string]: any } = { email: email };
- if (firstname) request_body['first_name'] = firstname;
- if (lastname) request_body['last_name'] = lastname;
- if (list) request_body['lists'] = [list];
-
- const response = (
- await callsendfoxApi(
- HttpMethod.POST,
- 'contacts',
- accessToken,
- request_body
- )
- ).body;
- return response;
+ const { email, firstname, lastname, list } = context.propsValue;
+ return await sendfoxApi.createContact({
+ auth: context.auth,
+ email,
+ firstName: firstname,
+ lastName: lastname,
+ lists: list ? [list] : undefined,
+ });
},
});
diff --git a/packages/pieces/community/sendfox/src/lib/actions/create-list.ts b/packages/pieces/community/sendfox/src/lib/actions/create-list.ts
index 59800984848..df2a22f6c65 100644
--- a/packages/pieces/community/sendfox/src/lib/actions/create-list.ts
+++ b/packages/pieces/community/sendfox/src/lib/actions/create-list.ts
@@ -1,9 +1,10 @@
import { createAction, Property } from '@activepieces/pieces-framework';
-import { sendfoxAuth } from '../auth';
-import { callsendfoxApi } from '../../common';
import { HttpMethod } from '@activepieces/pieces-common';
+import { sendfoxAuth } from '../auth';
+import { sendfoxClient } from '../common/client';
+import { createListOutputSchema } from '../output-schemas';
-export const createList = createAction({
+export const createListAction = createAction({
name: 'create-list',
classification: 'WRITE',
auth: sendfoxAuth,
@@ -11,6 +12,7 @@ export const createList = createAction({
description: 'Create a contact list in SendFox',
audience: 'both',
aiMetadata: { description: 'Creates a new contact list in SendFox with the given name. Use to set up a list before adding subscribers to it. Not idempotent: each call creates a new list even if one with the same name already exists.', idempotent: false },
+ outputSchema: createListOutputSchema,
props: {
task_name: Property.ShortText({
displayName: 'List Name',
@@ -19,14 +21,12 @@ export const createList = createAction({
}),
},
async run(context) {
- const authentication = context.auth;
- const accessToken = authentication.secret_text;
- const task_name = context.propsValue.task_name;
- const response = (
- await callsendfoxApi(HttpMethod.POST, 'lists', accessToken, {
- name: task_name,
- })
- ).body;
+ const response = await sendfoxClient.request<unknown>({
+ auth: context.auth,
+ method: HttpMethod.POST,
+ path: '/lists',
+ body: { name: context.propsValue.task_name },
+ });
return [response];
},
});
diff --git a/packages/pieces/community/sendfox/src/lib/actions/unsubscribe-contact.ts b/packages/pieces/community/sendfox/src/lib/actions/unsubscribe-contact.ts
index 7ab8d78baf2..0858accdb8e 100644
--- a/packages/pieces/community/sendfox/src/lib/actions/unsubscribe-contact.ts
+++ b/packages/pieces/community/sendfox/src/lib/actions/unsubscribe-contact.ts
@@ -1,9 +1,10 @@
import { createAction, MarkdownVariant, Property } from '@activepieces/pieces-framework';
-import { sendfoxAuth } from '../auth';
-import { callsendfoxApi } from '../../common';
import { HttpMethod } from '@activepieces/pieces-common';
+import { sendfoxAuth } from '../auth';
+import { sendfoxClient } from '../common/client';
+import { unsubscribeContactOutputSchema } from '../output-schemas';
-export const unsubscribe = createAction({
+export const unsubscribeContactAction = createAction({
name: 'unsubscribe',
classification: 'DESTRUCTIVE',
auth: sendfoxAuth,
@@ -11,6 +12,7 @@ export const unsubscribe = createAction({
description: 'Stop all SendFox emails to a contact',
audience: 'both',
aiMetadata: { description: 'Unsubscribes a contact from SendFox by email so they stop receiving emails. Use to honor an opt-out or remove someone from sends. Effectively idempotent in outcome (the contact ends up unsubscribed), but flagged not idempotent because each call issues a state-changing request.', idempotent: false },
+ outputSchema: unsubscribeContactOutputSchema,
props: {
info: Property.MarkDown({
value:
@@ -24,14 +26,12 @@ export const unsubscribe = createAction({
}),
},
async run(context) {
- const authentication = context.auth;
- const accessToken = authentication.secret_text;
- const email = context.propsValue.email;
- const response = (
- await callsendfoxApi(HttpMethod.PATCH, 'unsubscribe', accessToken, {
- email: email,
- })
- ).body;
+ const response = await sendfoxClient.request<unknown>({
+ auth: context.auth,
+ method: HttpMethod.PATCH,
+ path: '/unsubscribe',
+ body: { email: context.propsValue.email },
+ });
return [response];
},
});
diff --git a/packages/pieces/community/sendfox/src/lib/common/ai-props.ts b/packages/pieces/community/sendfox/src/lib/common/ai-props.ts
new file mode 100644
index 00000000000..c50dd163880
--- /dev/null
+++ b/packages/pieces/community/sendfox/src/lib/common/ai-props.ts
@@ -0,0 +1,59 @@
+import { Property } from '@activepieces/pieces-framework';
+import type { PropParams } from './props';
+
+function page<R extends boolean>({
+ required,
+ displayName = 'Page',
+ description = 'Page number to return, starting at 1. Defaults to 1. The response has `current_page` and `total`; request the next page while more results remain.',
+}: PropParams<R>) {
+ return Property.Number({ displayName, description, required });
+}
+
+function listId<R extends boolean>({
+ required,
+ displayName = 'List ID',
+ description = 'ID of a SendFox list, e.g. "123456". Use List Lists to find it.',
+}: PropParams<R>) {
+ return Property.ShortText({ displayName, description, required });
+}
+
+function contactId<R extends boolean>({
+ required,
+ displayName = 'Contact ID',
+ description = 'ID of a SendFox contact, e.g. "98765432". Create Contact returns it.',
+}: PropParams<R>) {
+ return Property.ShortText({ displayName, description, required });
+}
+
+function campaignId<R extends boolean>({
+ required,
+ displayName = 'Campaign ID',
+ description = 'ID of a SendFox campaign, e.g. "1234567". Use List Campaigns to find it.',
+}: PropParams<R>) {
+ return Property.ShortText({ displayName, description, required });
+}
+
+function tagId<R extends boolean>({
+ required,
+ displayName = 'Tag ID',
+ description = 'ID of a SendFox contact tag, e.g. "4321". Use List Tags to find it.',
+}: PropParams<R>) {
+ return Property.ShortText({ displayName, description, required });
+}
+
+function query<R extends boolean>({
+ required,
+ displayName = 'Search',
+ description = 'Text to filter results by. Leave empty to return all.',
+}: PropParams<R>) {
+ return Property.ShortText({ displayName, description, required });
+}
+
+export const sendfoxAiProps = {
+ page,
+ listId,
+ contactId,
+ campaignId,
+ tagId,
+ query,
+};
diff --git a/packages/pieces/community/sendfox/src/lib/common/api.ts b/packages/pieces/community/sendfox/src/lib/common/api.ts
new file mode 100644
index 00000000000..48966a0b11d
--- /dev/null
+++ b/packages/pieces/community/sendfox/src/lib/common/api.ts
@@ -0,0 +1,40 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { sendfoxClient } from './client';
+import type { SendfoxAuthValue, SendfoxContact } from './types';
+
+async function createContact({
+ auth,
+ email,
+ firstName,
+ lastName,
+ ipAddress,
+ lists,
+ contactFields,
+}: CreateContactParams & { auth: SendfoxAuthValue }): Promise<SendfoxContact> {
+ return await sendfoxClient.request<SendfoxContact>({
+ auth,
+ method: HttpMethod.POST,
+ path: '/contacts',
+ body: {
+ email,
+ ...(firstName ? { first_name: firstName } : {}),
+ ...(lastName ? { last_name: lastName } : {}),
+ ...(ipAddress ? { ip_address: ipAddress } : {}),
+ ...(lists && lists.length > 0 ? { lists } : {}),
+ ...(contactFields && contactFields.length > 0
+ ? { contact_fields: contactFields }
+ : {}),
+ },
+ });
+}
+
+export const sendfoxApi = { createContact };
+
+type CreateContactParams = {
+ email: string;
+ firstName?: string;
+ lastName?: string;
+ ipAddress?: string;
+ lists?: (string | number)[];
+ contactFields?: unknown[];
+};
diff --git a/packages/pieces/community/sendfox/src/lib/common/client.ts b/packages/pieces/community/sendfox/src/lib/common/client.ts
new file mode 100644
index 00000000000..7e6b0db6bab
--- /dev/null
+++ b/packages/pieces/community/sendfox/src/lib/common/client.ts
@@ -0,0 +1,64 @@
+import {
+ AuthenticationType,
+ HttpMethod,
+ httpClient,
+ QueryParams,
+} from '@activepieces/pieces-common';
+import type { SendfoxAuthValue, SendfoxPage } from './types';
+
+function baseUrl(): string {
+ return 'https://api.sendfox.com';
+}
+
+async function request<T>({
+ auth,
+ method,
+ path,
+ query,
+ body,
+}: RequestParams & { auth: SendfoxAuthValue }): Promise<T> {
+ const response = await httpClient.sendRequest<T>({
+ method,
+ url: `${baseUrl()}${path}`,
+ authentication: {
+ type: AuthenticationType.BEARER_TOKEN,
+ token: auth.secret_text,
+ },
+ queryParams: query,
+ body,
+ });
+ return response.body;
+}
+
+async function paginate<T>({
+ auth,
+ path,
+ query,
+ maxPages = MAX_PAGES,
+}: PaginateParams & { auth: SendfoxAuthValue }): Promise<T[]> {
+ const items: T[] = [];
+ let lastPage = 1;
+ for (let page = 1; page <= lastPage && page <= maxPages; page++) {
+ const response = await request<SendfoxPage<T>>({
+ auth,
+ method: HttpMethod.GET,
+ path,
+ query: { ...query, page: String(page) },
+ });
+ lastPage = response.last_page;
+ items.push(...response.data);
+ }
+ return items;
+}
+
+export const sendfoxClient = { baseUrl, request, paginate };
+
+const MAX_PAGES = 100;
+
+type RequestParams = {
+ method: HttpMethod;
+ path: string;
+ query?: QueryParams;
+ body?: unknown;
+};
+type PaginateParams = { path: string; query?: QueryParams; maxPages?: number };
diff --git a/packages/pieces/community/sendfox/src/lib/common/props.ts b/packages/pieces/community/sendfox/src/lib/common/props.ts
new file mode 100644
index 00000000000..a0e58121046
--- /dev/null
+++ b/packages/pieces/community/sendfox/src/lib/common/props.ts
@@ -0,0 +1,62 @@
+import { DropdownState, Property } from '@activepieces/pieces-framework';
+import { sendfoxAuth } from '../auth';
+import { sendfoxClient } from './client';
+import type { SendfoxList } from './types';
+
+function list<R extends boolean>({
+ required,
+ displayName = 'List',
+ description = 'A SendFox list.',
+}: PropParams<R>) {
+ return Property.Dropdown({
+ auth: sendfoxAuth,
+ displayName,
+ description,
+ required,
+ refreshers: ['auth'],
+ options: async ({ auth }) => {
+ if (!auth || !auth.secret_text) {
+ return disabledOptions({
+ placeholder: 'Please connect your account first',
+ });
+ }
+ try {
+ const lists = await sendfoxClient.paginate<SendfoxList>({
+ auth,
+ path: '/lists',
+ });
+ if (lists.length === 0) {
+ return {
+ disabled: false,
+ placeholder: 'No lists found. Create one in SendFox first.',
+ options: [],
+ };
+ }
+ return {
+ disabled: false,
+ options: lists.map((list) => ({ label: list.name, value: list.id })),
+ };
+ } catch {
+ return disabledOptions({
+ placeholder: 'Failed to load lists. Check your connection.',
+ });
+ }
+ },
+ });
+}
+
+function disabledOptions({
+ placeholder,
+}: {
+ placeholder: string;
+}): DropdownState<never> {
+ return { disabled: true, options: [], placeholder };
+}
+
+export const sendfoxProps = { list };
+
+export type PropParams<R extends boolean> = {
+ required: R;
+ displayName?: string;
+ description?: string;
+};
diff --git a/packages/pieces/community/sendfox/src/lib/common/types.ts b/packages/pieces/community/sendfox/src/lib/common/types.ts
new file mode 100644
index 00000000000..8d25bdc1a48
--- /dev/null
+++ b/packages/pieces/community/sendfox/src/lib/common/types.ts
@@ -0,0 +1,35 @@
+import type { AppConnectionType } from '@activepieces/pieces-framework';
+
+export type SendfoxAuthValue = {
+ type: AppConnectionType.SECRET_TEXT;
+ secret_text: string;
+};
+
+export type SendfoxList = { id: number; name: string };
+
+export type SendfoxPage<T> = {
+ current_page?: number;
+ data: T[];
+ last_page: number;
+};
+
+export type SendfoxContact = {
+ id: number;
+ email: string;
+ first_name?: string | null;
+ last_name?: string | null;
+ ip_address?: string | null;
+ unsubscribed_at?: string | null;
+ created_at?: string;
+ updated_at?: string;
+};
+
+export type SendfoxTag = {
+ id: number;
+ user_id?: number;
+ name: string;
+ color?: string | null;
+ contacts_count?: number;
+ created_at?: string;
+ updated_at?: string;
+};
diff --git a/packages/pieces/community/sendfox/src/lib/output-schemas.ts b/packages/pieces/community/sendfox/src/lib/output-schemas.ts
new file mode 100644
index 00000000000..9803a4a18a6
--- /dev/null
+++ b/packages/pieces/community/sendfox/src/lib/output-schemas.ts
@@ -0,0 +1,445 @@
+import { OutputSchema } from '@activepieces/pieces-framework';
+
+const paginationFields: OutputSchema['fields'] = [
+ { key: 'current_page', label: 'Current Page', format: 'number' },
+ { key: 'last_page', label: 'Last Page', format: 'number' },
+ { key: 'per_page', label: 'Per Page', format: 'number' },
+ { key: 'from', label: 'First Item Number', format: 'number' },
+ { key: 'to', label: 'Last Item Number', format: 'number' },
+ { key: 'total', label: 'Total', format: 'number' },
+ { key: 'path', label: 'Path', format: 'url' },
+ { key: 'first_page_url', label: 'First Page URL', format: 'url' },
+ { key: 'last_page_url', label: 'Last Page URL', format: 'url' },
+ { key: 'next_page_url', label: 'Next Page URL', format: 'url' },
+ { key: 'prev_page_url', label: 'Previous Page URL', format: 'url' },
+ {
+ key: 'links',
+ label: 'Page Links',
+ labelKey: 'label',
+ listItems: [
+ { key: 'url', label: 'URL', format: 'url' },
+ { key: 'label', label: 'Label' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ ],
+ },
+];
+
+const contactFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Contact ID', format: 'number' },
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'first_name', label: 'First Name' },
+ { key: 'last_name', label: 'Last Name' },
+ { key: 'ip_address', label: 'IP Address' },
+ { key: 'via_api', label: 'Added via API', format: 'boolean' },
+ { key: 'confirmation_sent_count', label: 'Confirmation Emails Sent', format: 'number' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+];
+
+const listFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'List ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'public_description', label: 'Public Description' },
+ { key: 'subscribed_contacts_count', label: 'Subscribed Contacts', format: 'number' },
+ { key: 'unsubscribed_contacts_count', label: 'Unsubscribed Contacts', format: 'number' },
+ { key: 'confirmation_campaign_id', label: 'Confirmation Campaign ID', format: 'number' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+];
+
+const tagFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Tag ID', format: 'number' },
+ { key: 'user_id', label: 'User ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'color', label: 'Color' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+];
+
+const automationFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Automation ID', format: 'number' },
+ { key: 'user_id', label: 'User ID', format: 'number' },
+ { key: 'title', label: 'Title' },
+ { key: 'active', label: 'Active', format: 'number' },
+ { key: 'template', label: 'Is Template', format: 'number' },
+ { key: 'automation_template_id', label: 'Automation Template ID', format: 'number' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'deleted_at', label: 'Deleted At', format: 'datetime' },
+];
+
+const formFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Form ID', format: 'number' },
+ { key: 'title', label: 'Title' },
+ { key: 'user_id', label: 'User ID', format: 'number' },
+ { key: 'url', label: 'Form URL', format: 'url' },
+ { key: 'redirect_url', label: 'Redirect URL', format: 'url' },
+ { key: 'landing_page_id', label: 'Landing Page ID', format: 'number' },
+ { key: 'gdpr_required', label: 'GDPR Consent Required', format: 'number' },
+ { key: 'gdpr_text', label: 'GDPR Text' },
+ { key: 'json_params', label: 'Form Settings' },
+ { key: 'recaptcha_enabled_at', label: 'reCAPTCHA Enabled At', format: 'datetime' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+];
+
+const contactFieldFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Field ID', format: 'number' },
+ { key: 'label', label: 'Label' },
+ { key: 'name', label: 'Name' },
+ { key: 'type', label: 'Type' },
+];
+
+const statsFields: OutputSchema['fields'] = [
+ { key: 'sent_count', label: 'Sent', format: 'number' },
+ { key: 'unique_open_count', label: 'Unique Opens', format: 'number' },
+ { key: 'unique_click_count', label: 'Unique Clicks', format: 'number' },
+ { key: 'unsubscribe_count', label: 'Unsubscribes', format: 'number' },
+ { key: 'bounce_count', label: 'Bounces', format: 'number' },
+ { key: 'spam_count', label: 'Spam Reports', format: 'number' },
+ { key: 'open_rate', label: 'Open Rate', format: 'number' },
+ { key: 'click_rate', label: 'Click Rate', format: 'number' },
+ { key: 'unsubscribe_rate', label: 'Unsubscribe Rate', format: 'number' },
+ { key: 'bounce_rate', label: 'Bounce Rate', format: 'number' },
+ { key: 'spam_rate', label: 'Spam Rate', format: 'number' },
+];
+
+const SUBJECT_TESTS = [
+ ['exclamationTest', 'Exclamation'],
+ ['tooShortTest', 'Too Short'],
+ ['tooLongTest', 'Too Long'],
+ ['fwdReTest', 'Fwd/Re Prefix'],
+ ['freeTest', 'Uses "Free"'],
+ ['capsWordsTest', 'All-Caps Words'],
+ ['lowercaseTest', 'All Lowercase'],
+ ['questionTest', 'Question'],
+ ['punctuationTest', 'Punctuation'],
+ ['personalizationTest', 'Personalization'],
+ ['emojiTest', 'Emoji'],
+ ['badWordTest', 'Bad Words'],
+ ['spamWordTest', 'Spam Words'],
+];
+
+const campaignFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Campaign ID', format: 'number' },
+ { key: 'title', label: 'Title' },
+ { key: 'subject', label: 'Subject' },
+ { key: 'slugged_subject', label: 'Subject Slug' },
+ { key: 'preview_text', label: 'Preview Text' },
+ { key: 'preview_text_auto', label: 'Auto Preview Text' },
+ { key: 'html', label: 'HTML' },
+ { key: 'from_name', label: 'From Name' },
+ { key: 'from_email', label: 'From Email', format: 'email' },
+ { key: 'user_id', label: 'User ID', format: 'number' },
+ { key: 'automation_item_id', label: 'Automation Item ID', format: 'number' },
+ { key: 'campaign_layout_id', label: 'Campaign Layout ID', format: 'number' },
+ { key: 'smart_campaign_id', label: 'Smart Campaign ID', format: 'number' },
+ { key: 'campaign_category_id', label: 'Campaign Category ID', format: 'number' },
+ { key: 'timezone', label: 'Timezone' },
+ { key: 'scheduled_at', label: 'Scheduled At', format: 'datetime' },
+ { key: 'sent_at', label: 'Sent At', format: 'datetime' },
+ { key: 'throttled_at', label: 'Throttled At', format: 'datetime' },
+ { key: 'cancelled_at', label: 'Cancelled At', format: 'datetime' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'is_web_gated', label: 'Web Gated', format: 'boolean' },
+ { key: 'active_contacts_only', label: 'Active Contacts Only', format: 'number' },
+ { key: 'attempted_send_count', label: 'Attempted Sends', format: 'number' },
+ { key: 'sent_count', label: 'Sent', format: 'number' },
+ { key: 'unique_open_count', label: 'Unique Opens', format: 'number' },
+ { key: 'unique_click_count', label: 'Unique Clicks', format: 'number' },
+ { key: 'unsubscribe_count', label: 'Unsubscribes', format: 'number' },
+ { key: 'bounce_count', label: 'Bounces', format: 'number' },
+ { key: 'spam_count', label: 'Spam Reports', format: 'number' },
+ {
+ key: 'subject_tester_results',
+ label: 'Subject Line Test',
+ children: [
+ { key: 'subject', label: 'Subject' },
+ { key: 'words', label: 'Word Count' },
+ { key: 'score', label: 'Score', format: 'number' },
+ { key: 'letterGrade', label: 'Letter Grade' },
+ { key: 'badWords', label: 'Bad Words Found' },
+ { key: 'spamWords', label: 'Spam Words Found' },
+ {
+ key: 'testMethods',
+ label: 'Test Weights',
+ children: SUBJECT_TESTS.map(([key, label]) => ({ key, label, format: 'number' as const })),
+ },
+ {
+ key: 'testResults',
+ label: 'Test Results',
+ children: SUBJECT_TESTS.map(([key, label]) => ({ key, label, format: 'boolean' as const })),
+ },
+ ],
+ },
+];
+
+const savedContentFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'html', label: 'HTML' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+];
+
+export const createContactOutputSchema: OutputSchema = {
+ fields: [...contactFields, { key: 'created_ago', label: 'Created Ago' }],
+};
+
+export const sendfoxAddContactToListOutputSchema: OutputSchema = {
+ fields: [
+ ...contactFields,
+ { key: 'form_id', label: 'Form ID', format: 'number' },
+ { key: 'contact_import_id', label: 'Contact Import ID', format: 'number' },
+ { key: 'social_platform_id', label: 'Social Platform ID' },
+ { key: 'unsubscribed_at', label: 'Unsubscribed At', format: 'datetime' },
+ { key: 'bounced_at', label: 'Bounced At', format: 'datetime' },
+ { key: 'invalid_at', label: 'Invalid At', format: 'datetime' },
+ { key: 'inactive_at', label: 'Inactive At', format: 'datetime' },
+ { key: 'confirmed_at', label: 'Confirmed At', format: 'datetime' },
+ { key: 'confirmation_sent_at', label: 'Confirmation Sent At', format: 'datetime' },
+ { key: 'first_sent_at', label: 'First Email Sent At', format: 'datetime' },
+ { key: 'last_sent_at', label: 'Last Email Sent At', format: 'datetime' },
+ { key: 'last_opened_at', label: 'Last Opened At', format: 'datetime' },
+ { key: 'last_clicked_at', label: 'Last Clicked At', format: 'datetime' },
+ { key: 'contact_fields', label: 'Custom Fields' },
+ { key: 'created_ago', label: 'Created Ago' },
+ ],
+};
+
+export const sendfoxAddTagToContactOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'tags',
+ label: 'Contact Tags',
+ labelKey: 'name',
+ listItems: [
+ ...tagFields,
+ {
+ key: 'pivot',
+ label: 'Tag Assignment',
+ children: [
+ { key: 'contact_id', label: 'Contact ID', format: 'number' },
+ { key: 'contact_tag_id', label: 'Tag ID', format: 'number' },
+ ],
+ },
+ ],
+ },
+ { key: 'count', label: 'Tag Count', format: 'number' },
+ ],
+};
+
+export const sendfoxGetAutomationOutputSchema: OutputSchema = {
+ fields: [
+ ...automationFields,
+ {
+ key: 'automation_triggers',
+ label: 'Triggers',
+ labelKey: 'type',
+ listItems: [
+ { key: 'id', label: 'Trigger ID', format: 'number' },
+ { key: 'automation_id', label: 'Automation ID', format: 'number' },
+ { key: 'type', label: 'Type' },
+ { key: 'list_id', label: 'List ID', format: 'number' },
+ { key: 'contact_tag_id', label: 'Tag ID', format: 'number' },
+ { key: 'campaign_id', label: 'Campaign ID', format: 'number' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ ],
+ },
+ { key: 'automation_items', label: 'Steps' },
+ ],
+};
+
+export const sendfoxGetCampaignOutputSchema: OutputSchema = {
+ fields: [
+ ...campaignFields,
+ { key: 'lists', label: 'Lists' },
+ { key: 'excluded_lists', label: 'Excluded Lists' },
+ { key: 'contact_tags', label: 'Tags' },
+ { key: 'excluded_contact_tags', label: 'Excluded Tags' },
+ ],
+};
+
+export const sendfoxGetCampaignStatsOutputSchema: OutputSchema = {
+ fields: [
+ ...statsFields,
+ {
+ key: 'link_stats',
+ label: 'Link Clicks',
+ labelKey: 'url',
+ listItems: [
+ { key: 'url', label: 'URL', format: 'url' },
+ { key: 'clicks', label: 'Clicks', format: 'number' },
+ ],
+ },
+ ],
+};
+
+export const sendfoxGetContactFieldOutputSchema: OutputSchema = {
+ fields: contactFieldFields,
+};
+
+export const sendfoxGetCurrentUserOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'id', label: 'User ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'country', label: 'Country' },
+ { key: 'timezone', label: 'Timezone' },
+ { key: 'language', label: 'Language' },
+ { key: 'vanity_path', label: 'Vanity Path' },
+ { key: 'disabled_at', label: 'Disabled At', format: 'datetime' },
+ { key: 'device_verification_enabled', label: 'Device Verification Enabled', format: 'boolean' },
+ { key: 'disable_optimization', label: 'Optimization Disabled', format: 'number' },
+ { key: 'opt_out_product_updates_at', label: 'Opted Out of Product Updates At', format: 'datetime' },
+ { key: 'contact_referrals_enabled_at', label: 'Contact Referrals Enabled At', format: 'datetime' },
+ { key: 'transactional_enabled_at', label: 'Transactional Enabled At', format: 'datetime' },
+ { key: 'transactional_paused_at', label: 'Transactional Paused At', format: 'datetime' },
+ { key: 'transactional_pause_reason', label: 'Transactional Pause Reason' },
+ { key: 'transactional_digest_enabled', label: 'Transactional Digest Enabled' },
+ { key: 'transactional_first_live_at', label: 'First Live Transactional Email At', format: 'datetime' },
+ { key: 'user_agent', label: 'User Agent' },
+ { key: 'google_id', label: 'Google ID' },
+ ],
+};
+
+export const sendfoxGetFormOutputSchema: OutputSchema = {
+ fields: [
+ ...formFields,
+ { key: 'lists', label: 'Lists', labelKey: 'name', listItems: listFields },
+ ],
+};
+
+export const sendfoxGetListOutputSchema: OutputSchema = {
+ fields: [
+ ...listFields,
+ { key: 'average_email_open_percent', label: 'Average Open Rate (%)', format: 'number' },
+ { key: 'average_email_click_percent', label: 'Average Click Rate (%)', format: 'number' },
+ ],
+};
+
+export const sendfoxGetTagOutputSchema: OutputSchema = {
+ fields: [...tagFields, { key: 'contacts_count', label: 'Contacts', format: 'number' }],
+};
+
+export const sendfoxListAutomationsOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'data', label: 'Automations', labelKey: 'title', listItems: automationFields },
+ ...paginationFields,
+ ],
+};
+
+export const sendfoxListCampaignTemplatesOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'data',
+ label: 'Templates',
+ labelKey: 'name',
+ listItems: [
+ ...savedContentFields,
+ { key: 'subject', label: 'Subject' },
+ { key: 'preview_text', label: 'Preview Text' },
+ { key: 'campaign_layout_id', label: 'Campaign Layout ID' },
+ ],
+ },
+ ...paginationFields,
+ ],
+};
+
+export const sendfoxListCampaignSectionsOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'data', label: 'Sections', labelKey: 'name', listItems: savedContentFields },
+ ...paginationFields,
+ ],
+};
+
+export const sendfoxListCampaignStatsOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'data',
+ label: 'Campaign Stats',
+ labelKey: 'id',
+ listItems: [{ key: 'id', label: 'Campaign ID', format: 'number' }, ...statsFields],
+ },
+ ],
+};
+
+export const sendfoxListCampaignsOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'data', label: 'Campaigns', labelKey: 'title', listItems: campaignFields },
+ ...paginationFields,
+ ],
+};
+
+export const sendfoxListContactFieldsOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'data', label: 'Contact Fields', labelKey: 'label', listItems: contactFieldFields },
+ ...paginationFields,
+ ],
+};
+
+export const sendfoxListFormsOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'data', label: 'Forms', labelKey: 'title', listItems: formFields },
+ ...paginationFields,
+ ],
+};
+
+export const sendfoxListListsOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'data', label: 'Lists', labelKey: 'name', listItems: listFields },
+ ...paginationFields,
+ ],
+};
+
+export const sendfoxListTagsOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'data',
+ label: 'Tags',
+ labelKey: 'name',
+ listItems: [...tagFields, { key: 'contacts_count', label: 'Contacts', format: 'number' }],
+ },
+ ...paginationFields,
+ ],
+};
+
+export const createListOutputSchema: OutputSchema = {
+ itemLabel: '{name}',
+ fields: [
+ {
+ key: 'lists',
+ label: 'Created List',
+ value: '',
+ listItems: [
+ ...listFields,
+ { key: 'user_id', label: 'User ID', format: 'number' },
+ { key: 'average_email_open_percent', label: 'Average Open Rate (%)', format: 'number' },
+ { key: 'average_email_click_percent', label: 'Average Click Rate (%)', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ ],
+ },
+ ],
+};
+
+export const unsubscribeContactOutputSchema: OutputSchema = {
+ itemLabel: '{email}',
+ fields: [
+ {
+ key: 'contacts',
+ label: 'Unsubscribed Contact',
+ value: '',
+ listItems: [
+ { key: 'id', label: 'Contact ID', format: 'number' },
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'first_name', label: 'First Name' },
+ { key: 'last_name', label: 'Last Name' },
+ { key: 'ip_address', label: 'IP Address' },
+ { key: 'unsubscribed_at', label: 'Unsubscribed At', format: 'datetime' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ ],
+ },
+ ],
+};