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:
poduck
2025-12-18 22:59:37 -05:00
parent 9848268d34
commit 3aa7199503
16292 changed files with 1284892 additions and 4708 deletions

View File

@@ -0,0 +1,28 @@
{
"Line Bot": "Line Bot",
"Build chatbots for LINE": "Build chatbots for LINE",
"Push Message": "Push Message",
"Custom API Call": "Custom API Call",
"Push message to the line account": "Push message to the line account",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"User Id": "User Id",
"Text": "Text",
"Method": "Method",
"Headers": "Headers",
"Query Parameters": "Query Parameters",
"Body": "Body",
"No Error on Failure": "No Error on Failure",
"Timeout (in seconds)": "Timeout (in seconds)",
"The user id can be obtained from the webhook payload": "The user id can be obtained from the webhook payload",
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
"HEAD": "HEAD",
"New Message": "New Message",
"Triggers when a new message is received": "Triggers when a new message is received",
"Markdown": "Markdown",
"\n- Create Line bot account from Developer Console\n- Go to the \"Messaging API\" section.\n- In the webhook settings, paste this URL: \n `{{webhookUrl}}`\n- Publish Activepieces flow first then click \"Verify\" button\n": "\n- Create Line bot account from Developer Console\n- Go to the \"Messaging API\" section.\n- In the webhook settings, paste this URL: \n `{{webhookUrl}}`\n- Publish Activepieces flow first then click \"Verify\" button\n"
}

View File

@@ -0,0 +1,29 @@
{
"Build chatbots for LINE": "Erstelle Chatbots für LINE",
"Push Message": "Push-Nachricht",
"Custom API Call": "Eigener API-Aufruf",
"Push message to the line account": "Nachricht auf das Zeilenkonto schieben",
"Make a custom API call to a specific endpoint": "Einen benutzerdefinierten API-Aufruf an einen bestimmten Endpunkt machen",
"User Id": "Benutzer-Id",
"Text": "Text",
"Method": "Methode",
"Headers": "Kopfzeilen",
"Query Parameters": "Abfrageparameter",
"Body": "Körper",
"Response is Binary ?": "Antwort ist binär?",
"No Error on Failure": "Kein Fehler bei Fehler",
"Timeout (in seconds)": "Timeout (in Sekunden)",
"The user id can be obtained from the webhook payload": "Die Benutzer-ID kann über die webhook Nutzlast abgerufen werden",
"Authorization headers are injected automatically from your connection.": "Autorisierungs-Header werden automatisch von Ihrer Verbindung injiziert.",
"Enable for files like PDFs, images, etc..": "Aktivieren für Dateien wie PDFs, Bilder, etc..",
"GET": "ERHALTEN",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "LÖSCHEN",
"HEAD": "HEAD",
"New Message": "Neue Nachricht",
"Triggers when a new message is received": "Wird ausgelöst, wenn eine neue Nachricht empfangen wird",
"Markdown": "Markdown",
"\n- Create Line bot account from Developer Console\n- Go to the \"Messaging API\" section.\n- In the webhook settings, paste this URL: \n `{{webhookUrl}}`\n- Publish Activepieces flow first then click \"Verify\" button\n": "\n- Line-Bot-Konto von Entwickler-Konsole\n- Gehen Sie zu \"Messaging API\".\n- In den Webhook-Einstellungen, füge diese URL ein: \n `{{webhookUrl}}`\n- Aktivierungsfluss veröffentlichen und dann auf \"Überprüfen\" Button\n"
}

View File

@@ -0,0 +1,29 @@
{
"Build chatbots for LINE": "Construir chatbots para LINE",
"Push Message": "Enviar mensaje",
"Custom API Call": "Llamada API personalizada",
"Push message to the line account": "Enviar mensaje a la cuenta de línea",
"Make a custom API call to a specific endpoint": "Hacer una llamada API personalizada a un extremo específico",
"User Id": "Id de Usuario",
"Text": "Texto",
"Method": "Método",
"Headers": "Encabezados",
"Query Parameters": "Parámetros de consulta",
"Body": "Cuerpo",
"Response is Binary ?": "¿Respuesta es binaria?",
"No Error on Failure": "No hay ningún error en fallo",
"Timeout (in seconds)": "Tiempo de espera (en segundos)",
"The user id can be obtained from the webhook payload": "El id de usuario se puede obtener de la carga del webhook",
"Authorization headers are injected automatically from your connection.": "Las cabeceras de autorización se inyectan automáticamente desde tu conexión.",
"Enable for files like PDFs, images, etc..": "Activar para archivos como PDFs, imágenes, etc.",
"GET": "RECOGER",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "BORRAR",
"HEAD": "LIMPIO",
"New Message": "Nuevo mensaje",
"Triggers when a new message is received": "Dispara cuando se recibe un nuevo mensaje",
"Markdown": "Markdown",
"\n- Create Line bot account from Developer Console\n- Go to the \"Messaging API\" section.\n- In the webhook settings, paste this URL: \n `{{webhookUrl}}`\n- Publish Activepieces flow first then click \"Verify\" button\n": "\n- Create Line bot account from Developer Console\n- Go to the \"Messaging API\" section.\n- In the webhook settings, paste this URL: \n `{{webhookUrl}}`\n- Publish Activepieces flow first then click \"Verify\" button\n"
}

View File

@@ -0,0 +1,29 @@
{
"Build chatbots for LINE": "Construire des chatbots pour LINE",
"Push Message": "Message Push",
"Custom API Call": "Appel API personnalisé",
"Push message to the line account": "Envoyer un message vers le compte en ligne",
"Make a custom API call to a specific endpoint": "Passez un appel API personnalisé à un point de terminaison spécifique",
"User Id": "Identifiant de l'utilisateur",
"Text": "Texte du texte",
"Method": "Méthode",
"Headers": "En-têtes",
"Query Parameters": "Paramètres de requête",
"Body": "Corps",
"Response is Binary ?": "La réponse est Binaire ?",
"No Error on Failure": "Aucune erreur en cas d'échec",
"Timeout (in seconds)": "Délai d'attente (en secondes)",
"The user id can be obtained from the webhook payload": "L'identifiant de l'utilisateur peut être obtenu à partir de la charge utile du webhook",
"Authorization headers are injected automatically from your connection.": "Les en-têtes d'autorisation sont injectés automatiquement à partir de votre connexion.",
"Enable for files like PDFs, images, etc..": "Activer pour les fichiers comme les PDFs, les images, etc.",
"GET": "OBTENIR",
"POST": "POSTER",
"PATCH": "PATCH",
"PUT": "EFFACER",
"DELETE": "SUPPRIMER",
"HEAD": "TÊTE",
"New Message": "Nouveau message",
"Triggers when a new message is received": "Déclenche quand un nouveau message est reçu",
"Markdown": "Markdown",
"\n- Create Line bot account from Developer Console\n- Go to the \"Messaging API\" section.\n- In the webhook settings, paste this URL: \n `{{webhookUrl}}`\n- Publish Activepieces flow first then click \"Verify\" button\n": "\n- Create Line bot account from Developer Console\n- Go to the \"Messaging API\" section.\n- In the webhook settings, paste this URL: \n `{{webhookUrl}}`\n- Publish Activepieces flow first then click \"Verify\" button\n"
}

View File

@@ -0,0 +1,28 @@
{
"Line Bot": "Line Bot",
"Build chatbots for LINE": "Build chatbots for LINE",
"Push Message": "Push Message",
"Custom API Call": "Custom API Call",
"Push message to the line account": "Push message to the line account",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"User Id": "User Id",
"Text": "Text",
"Method": "Method",
"Headers": "Headers",
"Query Parameters": "Query Parameters",
"Body": "Body",
"No Error on Failure": "No Error on Failure",
"Timeout (in seconds)": "Timeout (in seconds)",
"The user id can be obtained from the webhook payload": "The user id can be obtained from the webhook payload",
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
"HEAD": "HEAD",
"New Message": "New Message",
"Triggers when a new message is received": "Triggers when a new message is received",
"Markdown": "Markdown",
"\n- Create Line bot account from Developer Console\n- Go to the \"Messaging API\" section.\n- In the webhook settings, paste this URL: \n `{{webhookUrl}}`\n- Publish Activepieces flow first then click \"Verify\" button\n": "\n- Create Line bot account from Developer Console\n- Go to the \"Messaging API\" section.\n- In the webhook settings, paste this URL: \n `{{webhookUrl}}`\n- Publish Activepieces flow first then click \"Verify\" button\n"
}

View File

@@ -0,0 +1,28 @@
{
"Line Bot": "Line Bot",
"Build chatbots for LINE": "Build chatbots for LINE",
"Push Message": "Push Message",
"Custom API Call": "Custom API Call",
"Push message to the line account": "Push message to the line account",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"User Id": "User Id",
"Text": "Text",
"Method": "Method",
"Headers": "Headers",
"Query Parameters": "Query Parameters",
"Body": "Body",
"No Error on Failure": "No Error on Failure",
"Timeout (in seconds)": "Timeout (in seconds)",
"The user id can be obtained from the webhook payload": "The user id can be obtained from the webhook payload",
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
"HEAD": "HEAD",
"New Message": "New Message",
"Triggers when a new message is received": "Triggers when a new message is received",
"Markdown": "Markdown",
"\n- Create Line bot account from Developer Console\n- Go to the \"Messaging API\" section.\n- In the webhook settings, paste this URL: \n `{{webhookUrl}}`\n- Publish Activepieces flow first then click \"Verify\" button\n": "\n- Create Line bot account from Developer Console\n- Go to the \"Messaging API\" section.\n- In the webhook settings, paste this URL: \n `{{webhookUrl}}`\n- Publish Activepieces flow first then click \"Verify\" button\n"
}

View File

@@ -0,0 +1,29 @@
{
"Build chatbots for LINE": "LINE 用のチャットボットを構築",
"Push Message": "Push Message",
"Custom API Call": "カスタムAPI通話",
"Push message to the line account": "ラインアカウントにメッセージを送る",
"Make a custom API call to a specific endpoint": "特定のエンドポイントへのカスタム API コールを実行します。",
"User Id": "ユーザー ID",
"Text": "テキスト",
"Method": "方法",
"Headers": "ヘッダー",
"Query Parameters": "クエリパラメータ",
"Body": "本文",
"Response is Binary ?": "応答はバイナリですか?",
"No Error on Failure": "失敗時にエラーはありません",
"Timeout (in seconds)": "タイムアウト(秒)",
"The user id can be obtained from the webhook payload": "ユーザ ID は webhook ペイロードから取得できます",
"Authorization headers are injected automatically from your connection.": "認証ヘッダは接続から自動的に注入されます。",
"Enable for files like PDFs, images, etc..": "PDF、画像などのファイルを有効にします。",
"GET": "取得",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "削除",
"HEAD": "頭",
"New Message": "新しいメッセージ",
"Triggers when a new message is received": "新しいメッセージを受信したときにトリガーする",
"Markdown": "Markdown",
"\n- Create Line bot account from Developer Console\n- Go to the \"Messaging API\" section.\n- In the webhook settings, paste this URL: \n `{{webhookUrl}}`\n- Publish Activepieces flow first then click \"Verify\" button\n": "\n- Create Line bot account from Developer Console\n- Go to the \"Messaging API\" section.\n- In the webhook settings, paste this URL: \n `{{webhookUrl}}`\n- Publish Activepieces flow first then click \"Verify\" button\n"
}

View File

@@ -0,0 +1,29 @@
{
"Build chatbots for LINE": "Bouw chatbots voor LINE",
"Push Message": "Bericht pushen",
"Custom API Call": "Custom API Call",
"Push message to the line account": "Stuur bericht naar de regelaccount",
"Make a custom API call to a specific endpoint": "Maak een aangepaste API call naar een specifiek eindpunt",
"User Id": "Gebruikers ID",
"Text": "Tekstveld",
"Method": "Methode",
"Headers": "Kopteksten",
"Query Parameters": "Query parameters",
"Body": "Lichaam",
"Response is Binary ?": "Antwoord is binair?",
"No Error on Failure": "Geen fout bij fout",
"Timeout (in seconds)": "Time-out (in seconden)",
"The user id can be obtained from the webhook payload": "De gebruikers-id kan worden verkregen via de webhook payload",
"Authorization headers are injected automatically from your connection.": "Autorisatie headers worden automatisch geïnjecteerd vanuit uw verbinding.",
"Enable for files like PDFs, images, etc..": "Inschakelen voor bestanden zoals PDF's, afbeeldingen etc..",
"GET": "KRIJG",
"POST": "POSTE",
"PATCH": "BEKIJK",
"PUT": "PUT",
"DELETE": "VERWIJDEREN",
"HEAD": "HOOFD",
"New Message": "Nieuw bericht",
"Triggers when a new message is received": "Triggert wanneer een nieuw bericht wordt ontvangen",
"Markdown": "Markdown",
"\n- Create Line bot account from Developer Console\n- Go to the \"Messaging API\" section.\n- In the webhook settings, paste this URL: \n `{{webhookUrl}}`\n- Publish Activepieces flow first then click \"Verify\" button\n": "\n- Maak Line bot account aan van Developer Console\n- Ga naar de \"Messaging API\" sectie.\n- In de webhook instellingen plak deze URL: \n `{{webhookUrl}}`\n- Publiceer Activepieces flow en klik op \"Verifiëren\" knop\n"
}

View File

@@ -0,0 +1,29 @@
{
"Build chatbots for LINE": "Construa chatbots para LINE",
"Push Message": "Mensagem de Envio",
"Custom API Call": "Chamada de API personalizada",
"Push message to the line account": "Empurre mensagem para a conta de linha",
"Make a custom API call to a specific endpoint": "Faça uma chamada de API personalizada para um ponto de extremidade específico",
"User Id": "Identificação do Usuário",
"Text": "texto",
"Method": "Método",
"Headers": "Cabeçalhos",
"Query Parameters": "Parâmetros da consulta",
"Body": "Conteúdo",
"Response is Binary ?": "A resposta é binária ?",
"No Error on Failure": "Nenhum erro no Failure",
"Timeout (in seconds)": "Tempo limite (em segundos)",
"The user id can be obtained from the webhook payload": "A identificação do usuário pode ser obtida a partir da carga do webhook",
"Authorization headers are injected automatically from your connection.": "Os cabeçalhos de autorização são inseridos automaticamente a partir da sua conexão.",
"Enable for files like PDFs, images, etc..": "Habilitar para arquivos como PDFs, imagens, etc..",
"GET": "OBTER",
"POST": "POSTAR",
"PATCH": "COMPRAR",
"PUT": "COLOCAR",
"DELETE": "EXCLUIR",
"HEAD": "CABEÇA",
"New Message": "Nova mensagem",
"Triggers when a new message is received": "Aciona quando uma nova mensagem é recebida",
"Markdown": "Markdown",
"\n- Create Line bot account from Developer Console\n- Go to the \"Messaging API\" section.\n- In the webhook settings, paste this URL: \n `{{webhookUrl}}`\n- Publish Activepieces flow first then click \"Verify\" button\n": "\n- Crie uma conta do bot de linha a partir do Console\nde Desenvolvedor - Vá para a seção \"API de mensagens\".\n- Nas configurações do webhook colar esta URL: \n `{{webhookUrl}}`\n- Publicar o fluxo de peças ativas primeiro e depois clicar no botão \"Verificar\"\n"
}

View File

@@ -0,0 +1,28 @@
{
"Line Bot": "Line Bot",
"Build chatbots for LINE": "Построить чатботы для LINE",
"Push Message": "Отправить сообщение",
"Custom API Call": "Пользовательский вызов API",
"Push message to the line account": "Отправить сообщение в линейный аккаунт",
"Make a custom API call to a specific endpoint": "Сделать пользовательский API вызов к определенной конечной точке",
"User Id": "ID пользователя",
"Text": "Текст",
"Method": "Метод",
"Headers": "Заголовки",
"Query Parameters": "Параметры запроса",
"Body": "Тело",
"No Error on Failure": "Нет ошибок при ошибке",
"Timeout (in seconds)": "Таймаут (в секундах)",
"The user id can be obtained from the webhook payload": "Идентификатор пользователя может быть получен из webhook загрузчика",
"Authorization headers are injected automatically from your connection.": "Заголовки авторизации включаются автоматически из вашего соединения.",
"GET": "ПОЛУЧИТЬ",
"POST": "ПОСТ",
"PATCH": "ПАТЧ",
"PUT": "ПОКУПИТЬ",
"DELETE": "УДАЛИТЬ",
"HEAD": "HEAD",
"New Message": "Новое сообщение",
"Triggers when a new message is received": "Триггеры при получении нового сообщения",
"Markdown": "Markdown",
"\n- Create Line bot account from Developer Console\n- Go to the \"Messaging API\" section.\n- In the webhook settings, paste this URL: \n `{{webhookUrl}}`\n- Publish Activepieces flow first then click \"Verify\" button\n": "\n- Создать учетную запись линейного бота от Developer Console\n- Перейдите в раздел \"Messaging API\".\n- В настройках webhook, вставьте этот URL: \n `{{webhookUrl}}`\n- Опубликовать поток Activepieces затем нажмите кнопку \"Verify\"\n"
}

View File

@@ -0,0 +1,29 @@
{
"Build chatbots for LINE": "Build chatbots for LINE",
"Push Message": "Push Message",
"Custom API Call": "Custom API Call",
"Push message to the line account": "Push message to the line account",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"User Id": "User Id",
"Text": "Text",
"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)",
"The user id can be obtained from the webhook payload": "The user id can be obtained from the webhook payload",
"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",
"New Message": "New Message",
"Triggers when a new message is received": "Triggers when a new message is received",
"Markdown": "Markdown",
"\n- Create Line bot account from Developer Console\n- Go to the \"Messaging API\" section.\n- In the webhook settings, paste this URL: \n `{{webhookUrl}}`\n- Publish Activepieces flow first then click \"Verify\" button\n": "\n- Create Line bot account from Developer Console\n- Go to the \"Messaging API\" section.\n- In the webhook settings, paste this URL: \n `{{webhookUrl}}`\n- Publish Activepieces flow first then click \"Verify\" button\n"
}

View File

@@ -0,0 +1,28 @@
{
"Line Bot": "Line Bot",
"Build chatbots for LINE": "Build chatbots for LINE",
"Push Message": "Push Message",
"Custom API Call": "Custom API Call",
"Push message to the line account": "Push message to the line account",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"User Id": "User Id",
"Text": "Text",
"Method": "Method",
"Headers": "Headers",
"Query Parameters": "Query Parameters",
"Body": "Body",
"No Error on Failure": "No Error on Failure",
"Timeout (in seconds)": "Timeout (in seconds)",
"The user id can be obtained from the webhook payload": "The user id can be obtained from the webhook payload",
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
"HEAD": "HEAD",
"New Message": "New Message",
"Triggers when a new message is received": "Triggers when a new message is received",
"Markdown": "Markdown",
"\n- Create Line bot account from Developer Console\n- Go to the \"Messaging API\" section.\n- In the webhook settings, paste this URL: \n `{{webhookUrl}}`\n- Publish Activepieces flow first then click \"Verify\" button\n": "\n- Create Line bot account from Developer Console\n- Go to the \"Messaging API\" section.\n- In the webhook settings, paste this URL: \n `{{webhookUrl}}`\n- Publish Activepieces flow first then click \"Verify\" button\n"
}

View File

@@ -0,0 +1,29 @@
{
"Build chatbots for LINE": "Build chatbots for LINE",
"Push Message": "Push Message",
"Custom API Call": "自定义 API 呼叫",
"Push message to the line account": "Push message to the line account",
"Make a custom API call to a specific endpoint": "将一个自定义 API 调用到一个特定的终点",
"User Id": "User Id",
"Text": "文本",
"Method": "方法",
"Headers": "信头",
"Query Parameters": "查询参数",
"Body": "正文内容",
"Response is Binary ?": "Response is Binary ?",
"No Error on Failure": "失败时没有错误",
"Timeout (in seconds)": "超时(秒)",
"The user id can be obtained from the webhook payload": "The user id can be obtained from the webhook payload",
"Authorization headers are injected automatically from your connection.": "授权头自动从您的连接中注入。",
"Enable for files like PDFs, images, etc..": "Enable for files like PDFs, images, etc..",
"GET": "获取",
"POST": "帖子",
"PATCH": "PATCH",
"PUT": "弹出",
"DELETE": "删除",
"HEAD": "黑色",
"New Message": "New Message",
"Triggers when a new message is received": "Triggers when a new message is received",
"Markdown": "Markdown",
"\n- Create Line bot account from Developer Console\n- Go to the \"Messaging API\" section.\n- In the webhook settings, paste this URL: \n `{{webhookUrl}}`\n- Publish Activepieces flow first then click \"Verify\" button\n": "\n- Create Line bot account from Developer Console\n- Go to the \"Messaging API\" section.\n- In the webhook settings, paste this URL: \n `{{webhookUrl}}`\n- Publish Activepieces flow first then click \"Verify\" button\n"
}

View File

@@ -0,0 +1,32 @@
import { createCustomApiCallAction } from '@activepieces/pieces-common';
import { createPiece, PieceAuth } from '@activepieces/pieces-framework';
import { PieceCategory } from '@activepieces/shared';
import { pushMessage } from './lib/actions/push-message';
import { newMessage } from './lib/trigger/new-message';
export const lineAuth2 = PieceAuth.SecretText({
displayName: 'Bot Token',
required: true,
});
export const line = createPiece({
displayName: 'Line Bot',
description: 'Build chatbots for LINE',
auth: lineAuth2,
minimumSupportedRelease: '0.30.0',
logoUrl: 'https://cdn.activepieces.com/pieces/line.png',
categories: [PieceCategory.COMMUNICATION],
authors: ["kishanprmr","MoShizzle","abuaboud"],
actions: [
pushMessage,
createCustomApiCallAction({
baseUrl: () => 'https://api.line.me/v2',
auth: lineAuth2,
authMapping: async (auth) => ({
Authorization: `Bearer ${auth.secret_text}`,
}),
}),
],
triggers: [newMessage],
});

View File

@@ -0,0 +1,44 @@
import { Property, createAction } from '@activepieces/pieces-framework';
import { lineAuth2 } from '../..';
import {
AuthenticationType,
HttpMethod,
httpClient,
} from '@activepieces/pieces-common';
export const pushMessage = createAction({
name: 'push_message', // Must be a unique across the piece, this shouldn't be changed.
auth: lineAuth2,
displayName: 'Push Message',
description: 'Push message to the line account',
props: {
userId: Property.ShortText({
displayName: 'User Id',
description: 'The user id can be obtained from the webhook payload',
required: true,
}),
text: Property.ShortText({
displayName: 'Text',
required: true,
}),
},
async run(context) {
return httpClient.sendRequest({
method: HttpMethod.POST,
url: `https://api.line.me/v2/bot/message/push`,
authentication: {
type: AuthenticationType.BEARER_TOKEN,
token: context.auth.secret_text,
},
body: {
to: context.propsValue.userId,
messages: [
{
type: 'text',
text: context.propsValue.text,
},
],
},
});
},
});

View File

@@ -0,0 +1,43 @@
import {
createTrigger,
PieceAuth,
Property,
TriggerStrategy,
} from '@activepieces/pieces-framework';
const markdown = `
- Create Line bot account from Developer Console
- Go to the "Messaging API" section.
- In the webhook settings, paste this URL:
\`{{webhookUrl}}\`
- Publish Activepieces flow first then click "Verify" button
`;
export const newMessage = createTrigger({
name: 'new-message',
displayName: 'New Message',
auth: PieceAuth.None(),
description: 'Triggers when a new message is received',
props: {
md: Property.MarkDown({
value: markdown,
}),
},
type: TriggerStrategy.WEBHOOK,
sampleData: {},
async onEnable(context) {
// Empty
},
async onDisable(context) {
// Empty
},
async run(context) {
const { events } = context.payload.body as { events: unknown[] };
if (!events) {
return [];
}
return events.filter(
(event: any) => event.mode === 'active' && event.type === 'message'
);
},
});