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,63 @@
|
||||
import { createAction, Property } from '@activepieces/pieces-framework';
|
||||
import { v2 } from '@datadog/datadog-api-client';
|
||||
import { datadogAuth } from '../..';
|
||||
import { getDatadogConfiguration } from '../common';
|
||||
import { z } from 'zod';
|
||||
|
||||
export const sendMultipleLogs = createAction({
|
||||
name: 'sendMultipleLogs',
|
||||
displayName: 'Send Multiple logs',
|
||||
description: 'Send your logs to your Datadog platform over HTTP.',
|
||||
auth: datadogAuth,
|
||||
requireAuth: true,
|
||||
props: {
|
||||
body: Property.Json({
|
||||
displayName: 'Logs',
|
||||
required: true,
|
||||
description: `Logs to send to Datadog, must contain a \`logs\` key with an array of objects. Documentation: https://docs.datadoghq.com/api/latest/logs/#send-logs`,
|
||||
defaultValue: {logs: [
|
||||
{
|
||||
ddsource: "source",
|
||||
ddtags: "env:test,version:1.0",
|
||||
hostname: "hostname",
|
||||
message: "message",
|
||||
service: "service",
|
||||
additionalProperties: {
|
||||
status: "info",
|
||||
},
|
||||
},
|
||||
]}
|
||||
}),
|
||||
},
|
||||
async run({ auth, propsValue }) {
|
||||
/**
|
||||
* Documentation: https://docs.datadoghq.com/api/latest/logs/?code-lang=typescript
|
||||
*/
|
||||
const apiInstance = new v2.LogsApi(getDatadogConfiguration(auth));
|
||||
|
||||
// Validate the request body
|
||||
z.object({
|
||||
logs: z.array(
|
||||
z.object({
|
||||
message: z.string({error: "Log message cannot be empty"}),
|
||||
ddsource: z.string().optional(),
|
||||
ddtags: z.string().optional(),
|
||||
hostname: z.string().optional(),
|
||||
service: z.string().optional(),
|
||||
additionalProperties: z.record(z.string(), z.unknown()).optional(),
|
||||
}).strict().describe("Allowed properties are `message`, `ddsource`, `ddtags`, `hostname`, `service`, `additionalProperties`"),
|
||||
{ error: "Logs must be an array of objects under `logs` key e.g `{'logs': [{'message': 'test'}]}`"}
|
||||
).min(1, "At least one log entry is required")
|
||||
}).strict().parse(propsValue.body);
|
||||
|
||||
const params: v2.LogsApiSubmitLogRequest = {
|
||||
body: propsValue.body['logs'] as v2.HTTPLogItem[],
|
||||
};
|
||||
|
||||
await apiInstance.submitLog(params)
|
||||
return {
|
||||
success: true,
|
||||
message: 'Logs sent successfully',
|
||||
};
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,67 @@
|
||||
import { createAction, Property } from '@activepieces/pieces-framework';
|
||||
import { v2 } from '@datadog/datadog-api-client';
|
||||
import { datadogAuth } from '../..';
|
||||
import { getDatadogConfiguration } from '../common';
|
||||
|
||||
export const sendOneLog = createAction({
|
||||
name: 'sendOneLog',
|
||||
displayName: 'Send One log',
|
||||
description: 'Send one log to your Datadog platform over HTTP.',
|
||||
auth: datadogAuth,
|
||||
requireAuth: true,
|
||||
props: {
|
||||
message: Property.ShortText({
|
||||
displayName: 'Message',
|
||||
description: 'The message to send to Datadog',
|
||||
required: true,
|
||||
}),
|
||||
ddsource: Property.ShortText({
|
||||
displayName: 'DD Source',
|
||||
description: 'The DD source to send to Datadog',
|
||||
required: false,
|
||||
}),
|
||||
ddtags: Property.ShortText({
|
||||
displayName: 'DD Tags',
|
||||
description: 'The DD tags to send to Datadog, comma separated',
|
||||
required: false,
|
||||
}),
|
||||
hostname: Property.ShortText({
|
||||
displayName: 'Hostname',
|
||||
description: 'The hostname to send to Datadog',
|
||||
required: false,
|
||||
}),
|
||||
service: Property.ShortText({
|
||||
displayName: 'Service',
|
||||
description: 'The service to send to Datadog',
|
||||
required: false,
|
||||
}),
|
||||
additionalProperties: Property.Json({
|
||||
displayName: 'Additional Properties',
|
||||
description: 'Additional properties to send to Datadog, in key-value pairs like status, level, etc.',
|
||||
required: false,
|
||||
}),
|
||||
},
|
||||
async run({ auth, propsValue }) {
|
||||
/**
|
||||
* Documentation: https://docs.datadoghq.com/api/latest/logs/?code-lang=typescript
|
||||
*/
|
||||
const apiInstance = new v2.LogsApi(getDatadogConfiguration(auth));
|
||||
|
||||
const params: v2.LogsApiSubmitLogRequest = {
|
||||
body: [{
|
||||
message: propsValue.message,
|
||||
ddsource: propsValue.ddsource,
|
||||
ddtags: propsValue.ddtags,
|
||||
hostname: propsValue.hostname,
|
||||
service: propsValue.service,
|
||||
additionalProperties: propsValue.additionalProperties,
|
||||
}],
|
||||
};
|
||||
|
||||
await apiInstance.submitLog(params)
|
||||
return {
|
||||
success: true,
|
||||
message: 'Logs sent successfully',
|
||||
};
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,29 @@
|
||||
import { AppConnectionValueForAuthProperty } from '@activepieces/pieces-framework';
|
||||
import { client } from '@datadog/datadog-api-client';
|
||||
import { datadogAuth } from '../..';
|
||||
|
||||
|
||||
export const getDatadogConfiguration = (auth: AppConnectionValueForAuthProperty<typeof datadogAuth>) => {
|
||||
const configuration = client.createConfiguration(
|
||||
{authMethods: {
|
||||
apiKeyAuth: auth.props.apiKey,
|
||||
...(auth.props.appKey ? {appKeyAuth: auth.props.appKey} : {}),
|
||||
}}
|
||||
);
|
||||
configuration.setServerVariables({
|
||||
site: auth.props.site
|
||||
});
|
||||
return configuration;
|
||||
}
|
||||
|
||||
export const constructDatadogBaseUrl = (auth: AppConnectionValueForAuthProperty<typeof datadogAuth>, subdomain = 'api', version = 'v2') => {
|
||||
return `https://${subdomain}.${auth.props.site}/api/${version}`;
|
||||
};
|
||||
|
||||
export const constructDatadogBaseHeaders = (auth: AppConnectionValueForAuthProperty<typeof datadogAuth>) => {
|
||||
return {
|
||||
'Accept': 'application/json',
|
||||
'DD-API-KEY': auth.props.apiKey,
|
||||
...(auth.props.appKey ? {'DD-APPLICATION-KEY': auth.props.appKey} : {}),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user