Add Activepieces integration for workflow automation
- Add Activepieces fork with SmoothSchedule custom piece - Create integrations app with Activepieces service layer - Add embed token endpoint for iframe integration - Create Automations page with embedded workflow builder - Add sidebar visibility fix for embed mode - Add list inactive customers endpoint to Public API - Include SmoothSchedule triggers: event created/updated/cancelled - Include SmoothSchedule actions: create/update/cancel events, list resources/services/customers 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
|
||||
import { createPiece, PieceAuth } from "@activepieces/pieces-framework";
|
||||
import { generateAltTextAction } from "./lib/actions/generate-alt-text";
|
||||
import { createCustomApiCallAction } from "@activepieces/pieces-common";
|
||||
import { altTextAiAuth } from "./lib/common/auth";
|
||||
import { BASE_URL } from "./lib/common/constants";
|
||||
import { PieceCategory } from "@activepieces/shared";
|
||||
|
||||
export const altTextAi = createPiece({
|
||||
displayName: "AltText.ai",
|
||||
categories:[PieceCategory.ARTIFICIAL_INTELLIGENCE],
|
||||
auth: altTextAiAuth,
|
||||
minimumSupportedRelease: '0.36.1',
|
||||
logoUrl: "https://cdn.activepieces.com/pieces/alt-text-ai.png",
|
||||
authors: ['kishanprmr'],
|
||||
actions: [generateAltTextAction,
|
||||
createCustomApiCallAction({
|
||||
auth:altTextAiAuth,
|
||||
baseUrl:()=>BASE_URL,
|
||||
authMapping:async (auth)=>{
|
||||
return{
|
||||
'X-API-Key':auth.secret_text
|
||||
}
|
||||
}
|
||||
})
|
||||
],
|
||||
triggers: [],
|
||||
});
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
import { createAction, Property } from "@activepieces/pieces-framework";
|
||||
import { altTextAiAuth } from "../common/auth";
|
||||
import { httpClient, HttpMethod } from "@activepieces/pieces-common";
|
||||
import { BASE_URL } from "../common/constants";
|
||||
|
||||
export const generateAltTextAction = createAction({
|
||||
name: 'generate-alt-text',
|
||||
auth: altTextAiAuth,
|
||||
displayName: 'Generate Alt Text',
|
||||
description: 'Generates a descriptive alt text for a given image.',
|
||||
props: {
|
||||
image: Property.File({
|
||||
displayName: 'Image',
|
||||
required: true
|
||||
}),
|
||||
keywords: Property.Array({
|
||||
displayName: 'Keywords',
|
||||
required: false,
|
||||
description: 'keywords / phrases to be considered when generating the alt text.'
|
||||
}),
|
||||
negativeKeywords: Property.Array({
|
||||
displayName: 'Negative Keywords',
|
||||
required: false,
|
||||
description: 'negative keywords / phrases to be removed from any generated alt text.'
|
||||
}),
|
||||
keywordSource: Property.LongText({
|
||||
displayName: 'Keyword Source',
|
||||
required: false,
|
||||
description: 'Text to use as the source of keywords for the alt text.'
|
||||
})
|
||||
},
|
||||
async run(context) {
|
||||
const { image, keywords, keywordSource, negativeKeywords } = context.propsValue;
|
||||
|
||||
const response = await httpClient.sendRequest({
|
||||
method: HttpMethod.POST,
|
||||
url: BASE_URL + '/images',
|
||||
headers: {
|
||||
'X-API-Key': context.auth.secret_text
|
||||
},
|
||||
body: {
|
||||
image: {
|
||||
raw: image.base64
|
||||
},
|
||||
keywords,
|
||||
keyword_source: keywordSource,
|
||||
negative_keywords: negativeKeywords
|
||||
}
|
||||
})
|
||||
|
||||
return response.body;
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,30 @@
|
||||
import { PieceAuth } from "@activepieces/pieces-framework";
|
||||
import { httpClient, HttpMethod } from "@activepieces/pieces-common";
|
||||
import { BASE_URL } from "./constants";
|
||||
|
||||
export const altTextAiAuth = PieceAuth.SecretText({
|
||||
displayName: 'API Key',
|
||||
required: true,
|
||||
description: `You can obtain your API key from [Account Settings](https://alttext.ai/account/api_keys).`,
|
||||
validate: async ({ auth }) => {
|
||||
try {
|
||||
await httpClient.sendRequest({
|
||||
method: HttpMethod.GET,
|
||||
url: BASE_URL + '/account',
|
||||
headers: {
|
||||
'X-API-Key': auth
|
||||
}
|
||||
})
|
||||
|
||||
return {
|
||||
valid: true
|
||||
}
|
||||
|
||||
} catch {
|
||||
return {
|
||||
valid: false,
|
||||
error: 'Invalid API Key'
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1 @@
|
||||
export const BASE_URL = 'https://alttext.ai/api/v1'
|
||||
Reference in New Issue
Block a user