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 @@
|
||||
{
|
||||
"To generate an API key, go to Team Settings and navigate to the API Access tab. There, you’ll find the option to generate a new API key.": "To generate an API key, go to Team Settings and navigate to the API Access tab. There, you’ll find the option to generate a new API key.",
|
||||
"Ask Chatbot": "Ask Chatbot",
|
||||
"Custom API Call": "Custom API Call",
|
||||
"Sends a message to your bot and get back an answer.": "Sends a message to your bot and get back an answer.",
|
||||
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
|
||||
"Bot ID": "Bot ID",
|
||||
"Message": "Message",
|
||||
"Chat Session ID": "Chat Session ID",
|
||||
"Method": "Method",
|
||||
"Headers": "Headers",
|
||||
"Query Parameters": "Query Parameters",
|
||||
"Body": "Body",
|
||||
"Response is Binary ?": "Response is Binary ?",
|
||||
"No Error on Failure": "No Error on Failure",
|
||||
"Timeout (in seconds)": "Timeout (in seconds)",
|
||||
"You can obtain Bot ID from bot's settings menu.": "You can obtain Bot ID from bot's settings menu.",
|
||||
"The chat session id to keep track of a unique conversation. If not provided, it will default to generate a new one each time.You can obtain it from URL after /chats/.": "The chat session id to keep track of a unique conversation. If not provided, it will default to generate a new one each time.You can obtain it from URL after /chats/.",
|
||||
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
|
||||
"Enable for files like PDFs, images, etc..": "Enable for files like PDFs, images, etc..",
|
||||
"GET": "GET",
|
||||
"POST": "POST",
|
||||
"PATCH": "PATCH",
|
||||
"PUT": "PUT",
|
||||
"DELETE": "DELETE",
|
||||
"HEAD": "HEAD"
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import { createPiece } from '@activepieces/pieces-framework';
|
||||
import { chatnodeAuth } from './lib/common/auth';
|
||||
import { PieceCategory } from '@activepieces/shared';
|
||||
import { askChatbotAction } from './lib/actions/ask-chatbot';
|
||||
import { createCustomApiCallAction } from '@activepieces/pieces-common';
|
||||
import { BASE_URL } from './lib/common/constants';
|
||||
|
||||
export const chatnode = createPiece({
|
||||
displayName: 'ChatNode',
|
||||
auth: chatnodeAuth,
|
||||
minimumSupportedRelease: '0.36.1',
|
||||
logoUrl: 'https://cdn.activepieces.com/pieces/chatnode.png',
|
||||
categories: [
|
||||
PieceCategory.ARTIFICIAL_INTELLIGENCE,
|
||||
PieceCategory.PRODUCTIVITY,
|
||||
],
|
||||
authors: ['kishanprmr'],
|
||||
actions: [
|
||||
askChatbotAction,
|
||||
createCustomApiCallAction({
|
||||
auth: chatnodeAuth,
|
||||
baseUrl: () => BASE_URL,
|
||||
authMapping: async (auth) => {
|
||||
return {
|
||||
Authorization: `Bearer ${auth.secret_text}`,
|
||||
};
|
||||
},
|
||||
}),
|
||||
],
|
||||
triggers: [],
|
||||
});
|
||||
@@ -0,0 +1,50 @@
|
||||
import { createAction, Property } from '@activepieces/pieces-framework';
|
||||
import { chatnodeAuth } from '../common/auth';
|
||||
import {
|
||||
AuthenticationType,
|
||||
httpClient,
|
||||
HttpMethod,
|
||||
} from '@activepieces/pieces-common';
|
||||
import { BASE_URL } from '../common/constants';
|
||||
|
||||
export const askChatbotAction = createAction({
|
||||
name: 'ask-chatbot',
|
||||
auth: chatnodeAuth,
|
||||
displayName: 'Ask Chatbot',
|
||||
description: 'Sends a message to your bot and get back an answer.',
|
||||
props: {
|
||||
botId: Property.ShortText({
|
||||
displayName: 'Bot ID',
|
||||
required: true,
|
||||
description: "You can obtain Bot ID from bot's settings menu.",
|
||||
}),
|
||||
message: Property.LongText({
|
||||
displayName: 'Message',
|
||||
required: true,
|
||||
}),
|
||||
chatSessionId: Property.ShortText({
|
||||
displayName: 'Chat Session ID',
|
||||
description:
|
||||
'The chat session id to keep track of a unique conversation. If not provided, it will default to generate a new one each time.You can obtain it from URL after /chats/.',
|
||||
required: false,
|
||||
}),
|
||||
},
|
||||
async run(context) {
|
||||
const { botId, message, chatSessionId } = context.propsValue;
|
||||
|
||||
const response = await httpClient.sendRequest({
|
||||
method: HttpMethod.POST,
|
||||
url: BASE_URL + `/${botId}`,
|
||||
authentication: {
|
||||
type: AuthenticationType.BEARER_TOKEN,
|
||||
token: context.auth.secret_text,
|
||||
},
|
||||
body: {
|
||||
message,
|
||||
chat_session_id: chatSessionId,
|
||||
},
|
||||
});
|
||||
|
||||
return response.body;
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,34 @@
|
||||
import { PieceAuth } from '@activepieces/pieces-framework';
|
||||
import {
|
||||
AuthenticationType,
|
||||
httpClient,
|
||||
HttpMethod,
|
||||
} from '@activepieces/pieces-common';
|
||||
import { BASE_URL } from './constants';
|
||||
|
||||
export const chatnodeAuth = PieceAuth.SecretText({
|
||||
displayName: 'API Key',
|
||||
required: true,
|
||||
description:
|
||||
'To generate an API key, go to Team Settings and navigate to the API Access tab. There, you’ll find the option to generate a new API key.',
|
||||
validate: async ({ auth }) => {
|
||||
try {
|
||||
await httpClient.sendRequest({
|
||||
method: HttpMethod.GET,
|
||||
url: BASE_URL + '/auth_me',
|
||||
authentication: {
|
||||
type: AuthenticationType.BEARER_TOKEN,
|
||||
token: auth,
|
||||
},
|
||||
});
|
||||
return {
|
||||
valid: true,
|
||||
};
|
||||
} catch {
|
||||
return {
|
||||
valid: false,
|
||||
error: 'Invalid API Key',
|
||||
};
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
export const BASE_URL = 'https://api.public.chatnode.ai/v1'
|
||||
Reference in New Issue
Block a user