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,14 @@
|
||||
|
||||
import { createPiece } from "@activepieces/pieces-framework";
|
||||
import { tinyTalkAiAuth } from "./lib/common/auth";
|
||||
import { askBotAction } from "./lib/actions/ask-bot";
|
||||
|
||||
export const tinyTalkAi = createPiece({
|
||||
displayName: "Tiny Talk AI",
|
||||
auth: tinyTalkAiAuth,
|
||||
minimumSupportedRelease: '0.36.1',
|
||||
logoUrl: "https://cdn.activepieces.com/pieces/tiny-talk-ai.png",
|
||||
authors: ['kishanprmr'],
|
||||
actions: [askBotAction],
|
||||
triggers: [],
|
||||
});
|
||||
@@ -0,0 +1,86 @@
|
||||
import { createAction, Property } from "@activepieces/pieces-framework";
|
||||
import { tinyTalkAiAuth } from "../common/auth";
|
||||
|
||||
export const askBotAction = createAction({
|
||||
name: 'ask-bot',
|
||||
auth: tinyTalkAiAuth,
|
||||
displayName: 'Ask Bot',
|
||||
description: 'Sends message to selected bot.',
|
||||
props: {
|
||||
botId: Property.ShortText({
|
||||
displayName: 'Bot ID',
|
||||
required: true,
|
||||
description: 'You can find this in your Bot Details page in the dashboard.'
|
||||
}),
|
||||
prompt: Property.LongText({
|
||||
displayName: 'Question',
|
||||
required: true
|
||||
})
|
||||
},
|
||||
async run(context) {
|
||||
const { botId, prompt } = context.propsValue;
|
||||
|
||||
const response = await fetch("https://api.tinytalk.ai/v1/chat/completions", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Api-Key': context.auth.secret_text,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
botId,
|
||||
messages: [
|
||||
|
||||
{
|
||||
"role": "user",
|
||||
"content": prompt
|
||||
},
|
||||
]
|
||||
}),
|
||||
redirect: "follow",
|
||||
})
|
||||
|
||||
if (!response.ok) {
|
||||
const errorData = await response.json();
|
||||
throw Error(errorData.message);
|
||||
}
|
||||
|
||||
const stream = response.body;
|
||||
|
||||
if (!stream) {
|
||||
throw new Error("No stream returned from TinyTalk API");
|
||||
}
|
||||
|
||||
const reader = stream.getReader();
|
||||
const decoder = new TextDecoder();
|
||||
|
||||
let fullText = "";
|
||||
let done = false;
|
||||
|
||||
while (!done) {
|
||||
const { value, done: doneReading } = await reader.read();
|
||||
done = doneReading;
|
||||
|
||||
if (!value) continue;
|
||||
|
||||
const chunk = decoder.decode(value, { stream: true });
|
||||
|
||||
chunk.split("\n").forEach((line) => {
|
||||
if (line.startsWith("data: ") && !line.includes("[DONE]")) {
|
||||
try {
|
||||
const json = JSON.parse(line.replace("data: ", ""));
|
||||
const delta = json?.choices?.[0]?.delta;
|
||||
if (delta?.content) {
|
||||
fullText += delta.content;
|
||||
process.stdout.write(delta.content);
|
||||
}
|
||||
} catch {
|
||||
// ignore malformed lines
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return fullText;
|
||||
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,7 @@
|
||||
import { PieceAuth } from "@activepieces/pieces-framework";
|
||||
|
||||
export const tinyTalkAiAuth = PieceAuth.SecretText({
|
||||
displayName:'API Key',
|
||||
required:true,
|
||||
description:`You can obtain API key from [Dashboard Settings](https://dashboard.tinytalk.ai/).`
|
||||
})
|
||||
Reference in New Issue
Block a user