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,27 @@
|
||||
|
||||
import { createPiece } from "@activepieces/pieces-framework";
|
||||
import { promptAgentAction } from "./lib/actions/prompt-agent";
|
||||
import { uploadAgentFileAction } from "./lib/actions/upload-agent-file";
|
||||
import { createCustomApiCallAction } from "@activepieces/pieces-common";
|
||||
import { raiaAiAuth } from "./lib/common/auth";
|
||||
import { BASE_URL } from "./lib/common/constants";
|
||||
|
||||
export const raiaAi = createPiece({
|
||||
displayName: "raia",
|
||||
auth: raiaAiAuth,
|
||||
minimumSupportedRelease: '0.36.1',
|
||||
logoUrl: "https://cdn.activepieces.com/pieces/raia-ai.png",
|
||||
authors: ["kishanprmr"],
|
||||
actions: [promptAgentAction, uploadAgentFileAction,
|
||||
createCustomApiCallAction({
|
||||
auth: raiaAiAuth,
|
||||
baseUrl: () => BASE_URL,
|
||||
authMapping: async (auth) => {
|
||||
return {
|
||||
'Agent-Secret-Key': auth.secret_text
|
||||
}
|
||||
}
|
||||
})
|
||||
],
|
||||
triggers: [],
|
||||
});
|
||||
@@ -0,0 +1,30 @@
|
||||
import { createAction, Property } from "@activepieces/pieces-framework";
|
||||
import { raiaAiAuth } from "../common/auth";
|
||||
import { httpClient, HttpMethod } from "@activepieces/pieces-common";
|
||||
import { BASE_URL } from "../common/constants";
|
||||
|
||||
export const promptAgentAction = createAction({
|
||||
name: 'prompt-agent',
|
||||
displayName: 'Prompt Agent',
|
||||
description: 'Sends a prompt to a Raia Agent.',
|
||||
auth: raiaAiAuth,
|
||||
props: {
|
||||
prompt: Property.LongText({
|
||||
displayName: 'Prompt',
|
||||
required: true
|
||||
})
|
||||
},
|
||||
async run(context) {
|
||||
const response = await httpClient.sendRequest({
|
||||
method: HttpMethod.POST,
|
||||
url: BASE_URL + '/prompts',
|
||||
headers: {
|
||||
'Agent-Secret-Key': context.auth.secret_text,
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: { prompt: context.propsValue.prompt }
|
||||
})
|
||||
|
||||
return response.body
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,36 @@
|
||||
import { createAction, Property } from "@activepieces/pieces-framework";
|
||||
import { raiaAiAuth } from "../common/auth";
|
||||
import { httpClient, HttpMethod } from "@activepieces/pieces-common";
|
||||
import { BASE_URL } from "../common/constants";
|
||||
import FormData from 'form-data';
|
||||
|
||||
export const uploadAgentFileAction = createAction({
|
||||
name: 'upload-agent-file',
|
||||
displayName: 'Upload Agent File',
|
||||
description: 'Upload file to a Raia Agent.',
|
||||
auth: raiaAiAuth,
|
||||
props: {
|
||||
file: Property.File({
|
||||
displayName: 'File',
|
||||
required: true
|
||||
})
|
||||
},
|
||||
async run(context) {
|
||||
const {file} = context.propsValue
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('file',file.data,{filename:file.filename})
|
||||
|
||||
const response = await httpClient.sendRequest({
|
||||
method: HttpMethod.POST,
|
||||
url: BASE_URL + '/agent-files/upload',
|
||||
headers: {
|
||||
'Agent-Secret-Key': context.auth.secret_text,
|
||||
...formData.getHeaders()
|
||||
},
|
||||
body: formData
|
||||
})
|
||||
|
||||
return response.body
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,33 @@
|
||||
import { PieceAuth } from "@activepieces/pieces-framework";
|
||||
import { httpClient, HttpMethod } from "@activepieces/pieces-common";
|
||||
import { BASE_URL } from "./constants";
|
||||
|
||||
export const raiaAiAuth = PieceAuth.SecretText({
|
||||
displayName: 'API Key',
|
||||
required: true,
|
||||
description: `
|
||||
1. Open your agent in raiaAI Launch Pad and go to Agent → Skills.
|
||||
2. Add/enable “API Skill” (toggle it Active).
|
||||
3. In the API Skill settings, click “Generate Secret Key” (your agent’s API key).`,
|
||||
validate: async ({ auth }) => {
|
||||
try {
|
||||
await httpClient.sendRequest({
|
||||
method: HttpMethod.GET,
|
||||
url: BASE_URL + '/agents/by-api-key',
|
||||
headers: {
|
||||
'Agent-Secret-Key': auth
|
||||
}
|
||||
})
|
||||
|
||||
return {
|
||||
valid: true
|
||||
}
|
||||
}
|
||||
catch {
|
||||
return {
|
||||
valid: false,
|
||||
error: 'Invalid API Key.'
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1 @@
|
||||
export const BASE_URL = 'https://api.raia2.com/external'
|
||||
Reference in New Issue
Block a user