@coasy/piece-coasy 0.0.12 → 0.1.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -124,7 +124,7 @@ The piece uses custom authentication with:
124
124
 
125
125
  ## Publishing
126
126
 
127
- The piece is published as `@coasy/piece-coasy` to npm. Version is currently `0.0.11`.
127
+ The piece is published as `@coasy/piece-coasy` to npm. Version is currently `0.0.12`.
128
128
 
129
129
  To publish a new version:
130
130
  1. Navigate to the coasy piece directory:
package/package.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@coasy/piece-coasy",
3
- "version": "0.0.12"
3
+ "version": "0.1.0-rc.1"
4
4
  }
package/src/index.ts CHANGED
@@ -1,8 +1,32 @@
1
- import { createPiece, PieceAuth, Property } from '@activepieces/pieces-framework';
1
+ import {
2
+ createPiece,
3
+ PieceAuth,
4
+ Property,
5
+ } from '@activepieces/pieces-framework';
6
+ import { createEventParticipant } from './lib/actions/create-event-participant';
2
7
  import { createFunnelParticipant } from './lib/actions/create-funnel-participant';
8
+ import { createVoucher } from './lib/actions/create-voucher';
9
+ import { enrollUserCourse } from './lib/actions/enroll-user-course';
10
+ import { findEvent } from './lib/actions/find-event';
11
+ import { cancelledMembership } from './lib/triggers/cancelled-membership';
12
+ import { cancelledOrder } from './lib/triggers/cancelled-order';
13
+ import { cancelledOrderItem } from './lib/triggers/cancelled-order-item';
14
+ import { cancelledOrderprocess } from './lib/triggers/cancelled-orderprocess';
15
+ import { cancelledSubscription } from './lib/triggers/cancelled-subscription';
16
+ import { getEvents } from './lib/triggers/get-events';
17
+ import { newAppUserSignUp } from './lib/triggers/new-app-user-sign-up';
18
+ import { newAuthEvent } from './lib/triggers/new-auth-event';
19
+ import { newCustomer } from './lib/triggers/new-customer';
20
+ import { newEventParticipant } from './lib/triggers/new-event-participant';
3
21
  import { newFunnelParticipant } from './lib/triggers/new-funnel-participant';
22
+ import { newLead } from './lib/triggers/new-lead';
23
+ import { newMembership } from './lib/triggers/new-membership';
24
+ import { newOrder } from './lib/triggers/new-order';
25
+ import { newOrderItem } from './lib/triggers/new-order-item';
26
+ import { newSubscription } from './lib/triggers/new-subscription';
4
27
  import { newWebinarParticipant } from './lib/triggers/new-webinar-participant';
5
- import { newAuthEvent } from './lib/triggers/new-auth-event';
28
+ import { webinarParticipantAttend } from './lib/triggers/webinar-participant-attend';
29
+ import { webinarParticipantReminder } from './lib/triggers/webinar-participant-reminder';
6
30
 
7
31
  export const coasyAuth = PieceAuth.CustomAuth({
8
32
  required: true,
@@ -17,19 +41,44 @@ export const coasyAuth = PieceAuth.CustomAuth({
17
41
  apiKey: PieceAuth.SecretText({
18
42
  displayName: 'API Key',
19
43
  description: 'Enter the api key',
20
- required: true
21
- })
44
+ required: true,
45
+ }),
22
46
  },
23
47
  });
24
48
 
25
49
  export const coasy = createPiece({
26
50
  displayName: 'Coasy',
27
51
  auth: coasyAuth,
28
- description: 'Communicate with Coasy!',
52
+ description: 'Communicate with Coasy',
29
53
  minimumSupportedRelease: '0.20.0',
30
- logoUrl: 'https://console.achtsamkeitsakademie.de/favicon/apple-icon.png',
31
- authors: ["christian-schab"],
32
- actions: [createFunnelParticipant],
33
- triggers: [newFunnelParticipant, newWebinarParticipant, newAuthEvent]
54
+ logoUrl: 'https://console.coasy.io/favicon/apple-icon.png',
55
+ authors: ['christian-schab'],
56
+ actions: [
57
+ createEventParticipant,
58
+ createFunnelParticipant,
59
+ createVoucher,
60
+ enrollUserCourse,
61
+ findEvent,
62
+ ],
63
+ triggers: [
64
+ cancelledMembership,
65
+ cancelledOrder,
66
+ cancelledOrderItem,
67
+ cancelledOrderprocess,
68
+ cancelledSubscription,
69
+ getEvents,
70
+ newAppUserSignUp,
71
+ newAuthEvent,
72
+ newCustomer,
73
+ newEventParticipant,
74
+ newFunnelParticipant,
75
+ newLead,
76
+ newMembership,
77
+ newOrder,
78
+ newOrderItem,
79
+ newSubscription,
80
+ newWebinarParticipant,
81
+ webinarParticipantAttend,
82
+ webinarParticipantReminder,
83
+ ],
34
84
  });
35
-
@@ -0,0 +1,34 @@
1
+ import { createAction, Property } from "@activepieces/pieces-framework";
2
+ import { coasyAuth } from "../..";
3
+ import { CoasyClient } from "../common/coasyClient";
4
+
5
+ export const createEventParticipant = createAction({
6
+ auth: coasyAuth,
7
+ name: "createEventParticipant",
8
+ displayName: "Create Event Participant",
9
+ description: "Creates a new event participant",
10
+ props: {
11
+ eventId: Property.ShortText({
12
+ displayName: "Event ID",
13
+ description: "ID of event",
14
+ required: true
15
+ }),
16
+ categoryId: Property.ShortText({
17
+ displayName: "Category ID",
18
+ description: "ID of category",
19
+ required: false
20
+ })
21
+ },
22
+ async run(configValue) {
23
+ const { propsValue, auth } = configValue;
24
+ const client = new CoasyClient(
25
+ auth.baseUrl ?? "https://backend.api.prod.coasy.io",
26
+ auth.apiKey
27
+ );
28
+ const request = {
29
+ eventId: propsValue.eventId,
30
+ categoryId: propsValue.categoryId
31
+ };
32
+ return client.action("createEventParticipant", request);
33
+ }
34
+ });
@@ -31,7 +31,7 @@ export const createFunnelParticipant = createAction({
31
31
  },
32
32
  async run(configValue) {
33
33
  const { propsValue, auth } = configValue;
34
- const client = new CoasyClient(auth.baseUrl || 'https://backend.api.prod.coasy.io', auth.apiKey);
34
+ const client = new CoasyClient(auth.baseUrl ?? 'https://backend.api.prod.coasy.io', auth.apiKey);
35
35
  const request = {
36
36
  email: propsValue.email,
37
37
  firstName: propsValue.firstName,
@@ -0,0 +1,28 @@
1
+ import { createAction, Property } from '@activepieces/pieces-framework';
2
+ import { coasyAuth } from '../..';
3
+ import { CoasyClient } from '../common/coasyClient';
4
+
5
+ export const createVoucher = createAction({
6
+ auth: coasyAuth,
7
+ name: 'createVoucher',
8
+ displayName: 'Create Voucher',
9
+ description: 'Creates a new voucher',
10
+ props: {
11
+ offerId: Property.ShortText({
12
+ displayName: 'Offer ID',
13
+ description: 'ID of offer',
14
+ required: true,
15
+ }),
16
+ },
17
+ async run(configValue) {
18
+ const { propsValue, auth } = configValue;
19
+ const client = new CoasyClient(
20
+ auth.baseUrl ?? 'https://backend.api.prod.coasy.io',
21
+ auth.apiKey
22
+ );
23
+ const request = {
24
+ offerId: propsValue.offerId,
25
+ };
26
+ return client.action('createVoucher', request);
27
+ },
28
+ });
@@ -0,0 +1,40 @@
1
+ import { createAction, Property } from "@activepieces/pieces-framework";
2
+ import { coasyAuth } from "../..";
3
+ import { CoasyClient } from "../common/coasyClient";
4
+
5
+ export const enrollUserCourse = createAction({
6
+ auth: coasyAuth,
7
+ name: "enrollUserCourse",
8
+ displayName: "Enroll User Course",
9
+ description: "Enrolls user course",
10
+ props: {
11
+ userId: Property.ShortText({
12
+ displayName: "User ID",
13
+ description: "ID of User",
14
+ required: true
15
+ }),
16
+ courseId: Property.ShortText({
17
+ displayName: "Course ID",
18
+ description: "ID of Course",
19
+ required: true
20
+ }),
21
+ directGrant: Property.Checkbox({
22
+ displayName: "Direct Grant",
23
+ description: "Give direct grant",
24
+ required: true
25
+ })
26
+ },
27
+ async run(configValue) {
28
+ const { propsValue, auth } = configValue;
29
+ const client = new CoasyClient(
30
+ auth.baseUrl ?? "https://backend.api.prod.coasy.io",
31
+ auth.apiKey
32
+ );
33
+ const request = {
34
+ userId: propsValue.userId,
35
+ courseId: propsValue.courseId,
36
+ directGrant: propsValue.directGrant
37
+ };
38
+ return client.action("enrollUserCourse", request);
39
+ }
40
+ });
@@ -0,0 +1,28 @@
1
+ import { createAction, Property } from "@activepieces/pieces-framework";
2
+ import { coasyAuth } from "../..";
3
+ import { CoasyClient } from "../common/coasyClient";
4
+
5
+ export const findEvent = createAction({
6
+ auth: coasyAuth,
7
+ name: "findEvent",
8
+ displayName: "Find Event",
9
+ description: "Finds Event",
10
+ props: {
11
+ title: Property.ShortText({
12
+ displayName: "Title",
13
+ description: "Title Name",
14
+ required: false
15
+ })
16
+ },
17
+ async run(configValue) {
18
+ const { propsValue, auth } = configValue;
19
+ const client = new CoasyClient(
20
+ auth.baseUrl ?? "https://backend.api.prod.coasy.io",
21
+ auth.apiKey
22
+ );
23
+ const request = {
24
+ title: propsValue.title
25
+ };
26
+ return client.action("findEvent", request);
27
+ }
28
+ });
@@ -1,4 +1,9 @@
1
- import { AuthenticationType, httpClient, HttpMethod, HttpRequest } from '@activepieces/pieces-common';
1
+ import {
2
+ AuthenticationType,
3
+ httpClient,
4
+ HttpMethod,
5
+ HttpRequest,
6
+ } from '@activepieces/pieces-common';
2
7
 
3
8
  export class CoasyClient {
4
9
  private baseUrl: string;
@@ -9,7 +14,6 @@ export class CoasyClient {
9
14
  this.apiKey = apiKey;
10
15
  }
11
16
 
12
-
13
17
  async action(actionName: string, request: any) {
14
18
  return this.request(`/apps/actions/${actionName}`, request);
15
19
  }
@@ -18,21 +22,20 @@ export class CoasyClient {
18
22
  return this.request(`/apps/triggers/create`, {
19
23
  hookUrl,
20
24
  trigger,
21
- filter
25
+ filter,
22
26
  });
23
27
  }
24
28
 
25
29
  async destroyTrigger(webhookId: string) {
26
- return this.request(`/apps/triggers/destroy`, { webhookId})
30
+ return this.request(`/apps/triggers/destroy`, { webhookId });
27
31
  }
28
32
 
29
33
  async listTriggerEvents(trigger: string) {
30
34
  return this.request(`/apps/list`, {
31
- trigger
32
- })
35
+ trigger,
36
+ });
33
37
  }
34
38
 
35
-
36
39
  async request(path: string, requestBody: any) {
37
40
  const request: HttpRequest<string> = {
38
41
  method: HttpMethod.POST,
@@ -40,7 +43,7 @@ export class CoasyClient {
40
43
  body: JSON.stringify(requestBody),
41
44
  authentication: {
42
45
  type: AuthenticationType.BEARER_TOKEN,
43
- token: this.apiKey
46
+ token: this.apiKey,
44
47
  },
45
48
  };
46
49
 
@@ -52,5 +55,4 @@ export class CoasyClient {
52
55
  return response.body;
53
56
  }
54
57
  }
55
-
56
58
  }
@@ -33,7 +33,7 @@ export interface TestTriggerRequest {
33
33
 
34
34
  export const createCoasyTrigger = async (request: CreateTriggerRequest) => {
35
35
  const { triggerName, webhookUrl, filter, auth, store} = request;
36
- const client = new CoasyClient(auth.baseUrl || 'https://backend.api.prod.coasy.io', auth.apiKey);
36
+ const client = new CoasyClient(auth.baseUrl ?? 'https://backend.api.prod.coasy.io', auth.apiKey);
37
37
  const response = await client.createTrigger(triggerName, webhookUrl, filter);
38
38
  if (!response.id) throw new Error(`Failed to create Trigger!`);
39
39
  await store.put<string>(`${triggerName}__WEBHOOK_ID`, response.id);
@@ -44,14 +44,14 @@ export const destroyCoasyTrigger = async (request: DestroyTriggerRequest) => {
44
44
  const webhookId = await store.get<string>(`${triggerName}__WEBHOOK_ID`);
45
45
  if (!webhookId) throw new Error(`Webhook Id not found!`);
46
46
 
47
- const client = new CoasyClient(auth.baseUrl || 'https://backend.api.prod.coasy.io', auth.apiKey);
47
+ const client = new CoasyClient(auth.baseUrl ?? 'https://backend.api.prod.coasy.io', auth.apiKey);
48
48
  await client.destroyTrigger(webhookId);
49
49
  }
50
50
 
51
51
  export const testCoasyTrigger = async (request: TestTriggerRequest): Promise<any[]> => {
52
52
  const { triggerName, auth} = request;
53
53
 
54
- const client = new CoasyClient(auth.baseUrl || 'https://backend.api.prod.coasy.io', auth.apiKey);
54
+ const client = new CoasyClient(auth.baseUrl ?? 'https://backend.api.prod.coasy.io', auth.apiKey);
55
55
  const response = await client.listTriggerEvents(triggerName);
56
56
 
57
57
  return [{ test: true}];
@@ -0,0 +1,34 @@
1
+ import { createTrigger, Property, TriggerStrategy } from '@activepieces/pieces-framework';
2
+ import { coasyAuth } from '../..';
3
+ import { createCoasyTrigger, destroyCoasyTrigger, testCoasyTrigger } from '../common/triggers';
4
+
5
+ const triggerName = "CANCELLED_MEMBERSHIP";
6
+
7
+ export const cancelledMembership = createTrigger({
8
+ auth: coasyAuth,
9
+ name: 'cancelledMembership',
10
+ displayName: 'Cancelled Membership',
11
+ description: 'Triggers when a customer requests a membership cancellation.',
12
+ props: {},
13
+ sampleData: {},
14
+ type: TriggerStrategy.WEBHOOK,
15
+ onEnable: (context) => createCoasyTrigger({
16
+ triggerName,
17
+ webhookUrl: context.webhookUrl,
18
+ auth: context.auth,
19
+ filter: context.propsValue,
20
+ store: context.store
21
+ }),
22
+ onDisable: (context) => destroyCoasyTrigger({
23
+ triggerName,
24
+ auth: context.auth,
25
+ store: context.store
26
+ }),
27
+ test: (context) => testCoasyTrigger({
28
+ triggerName,
29
+ auth: context.auth
30
+ }),
31
+ async run(context) {
32
+ return [context.payload.body];
33
+ }
34
+ });
@@ -0,0 +1,34 @@
1
+ import { createTrigger, Property, TriggerStrategy } from '@activepieces/pieces-framework';
2
+ import { coasyAuth } from '../..';
3
+ import { createCoasyTrigger, destroyCoasyTrigger, testCoasyTrigger } from '../common/triggers';
4
+
5
+ const triggerName = "CANCELLED_ORDER_ITEM";
6
+
7
+ export const cancelledOrderItem = createTrigger({
8
+ auth: coasyAuth,
9
+ name: 'cancelledOrderItem',
10
+ displayName: 'Cancelled Order Item',
11
+ description: 'Triggers when an order item is cancelled.',
12
+ props: {},
13
+ sampleData: {},
14
+ type: TriggerStrategy.WEBHOOK,
15
+ onEnable: (context) => createCoasyTrigger({
16
+ triggerName,
17
+ webhookUrl: context.webhookUrl,
18
+ auth: context.auth,
19
+ filter: context.propsValue,
20
+ store: context.store
21
+ }),
22
+ onDisable: (context) => destroyCoasyTrigger({
23
+ triggerName,
24
+ auth: context.auth,
25
+ store: context.store
26
+ }),
27
+ test: (context) => testCoasyTrigger({
28
+ triggerName,
29
+ auth: context.auth
30
+ }),
31
+ async run(context) {
32
+ return [context.payload.body];
33
+ }
34
+ });
@@ -0,0 +1,34 @@
1
+ import { createTrigger, Property, TriggerStrategy } from '@activepieces/pieces-framework';
2
+ import { coasyAuth } from '../..';
3
+ import { createCoasyTrigger, destroyCoasyTrigger, testCoasyTrigger } from '../common/triggers';
4
+
5
+ const triggerName = "CANCELLED_ORDER";
6
+
7
+ export const cancelledOrder = createTrigger({
8
+ auth: coasyAuth,
9
+ name: 'cancelledOrder',
10
+ displayName: 'Cancelled Order',
11
+ description: 'Triggers when an order is cancelled.',
12
+ props: {},
13
+ sampleData: {},
14
+ type: TriggerStrategy.WEBHOOK,
15
+ onEnable: (context) => createCoasyTrigger({
16
+ triggerName,
17
+ webhookUrl: context.webhookUrl,
18
+ auth: context.auth,
19
+ filter: context.propsValue,
20
+ store: context.store
21
+ }),
22
+ onDisable: (context) => destroyCoasyTrigger({
23
+ triggerName,
24
+ auth: context.auth,
25
+ store: context.store
26
+ }),
27
+ test: (context) => testCoasyTrigger({
28
+ triggerName,
29
+ auth: context.auth
30
+ }),
31
+ async run(context) {
32
+ return [context.payload.body];
33
+ }
34
+ });
@@ -0,0 +1,34 @@
1
+ import { createTrigger, Property, TriggerStrategy } from '@activepieces/pieces-framework';
2
+ import { coasyAuth } from '../..';
3
+ import { createCoasyTrigger, destroyCoasyTrigger, testCoasyTrigger } from '../common/triggers';
4
+
5
+ const triggerName = "CANCELLED_ORDERPROCESS";
6
+
7
+ export const cancelledOrderprocess = createTrigger({
8
+ auth: coasyAuth,
9
+ name: 'cancelledOrderprocess',
10
+ displayName: 'Cancelled Order Process',
11
+ description: 'Triggers when a customer starts checkout but does not finish within 1 hour.',
12
+ props: {},
13
+ sampleData: {},
14
+ type: TriggerStrategy.WEBHOOK,
15
+ onEnable: (context) => createCoasyTrigger({
16
+ triggerName,
17
+ webhookUrl: context.webhookUrl,
18
+ auth: context.auth,
19
+ filter: context.propsValue,
20
+ store: context.store
21
+ }),
22
+ onDisable: (context) => destroyCoasyTrigger({
23
+ triggerName,
24
+ auth: context.auth,
25
+ store: context.store
26
+ }),
27
+ test: (context) => testCoasyTrigger({
28
+ triggerName,
29
+ auth: context.auth
30
+ }),
31
+ async run(context) {
32
+ return [context.payload.body];
33
+ }
34
+ });
@@ -0,0 +1,34 @@
1
+ import { createTrigger, Property, TriggerStrategy } from '@activepieces/pieces-framework';
2
+ import { coasyAuth } from '../..';
3
+ import { createCoasyTrigger, destroyCoasyTrigger, testCoasyTrigger } from '../common/triggers';
4
+
5
+ const triggerName = "CANCELLED_SUBSCRIPTION";
6
+
7
+ export const cancelledSubscription = createTrigger({
8
+ auth: coasyAuth,
9
+ name: 'cancelledSubscription',
10
+ displayName: 'Cancelled Subscription',
11
+ description: 'Triggers when a customer requests a subscription cancellation.',
12
+ props: {},
13
+ sampleData: {},
14
+ type: TriggerStrategy.WEBHOOK,
15
+ onEnable: (context) => createCoasyTrigger({
16
+ triggerName,
17
+ webhookUrl: context.webhookUrl,
18
+ auth: context.auth,
19
+ filter: context.propsValue,
20
+ store: context.store
21
+ }),
22
+ onDisable: (context) => destroyCoasyTrigger({
23
+ triggerName,
24
+ auth: context.auth,
25
+ store: context.store
26
+ }),
27
+ test: (context) => testCoasyTrigger({
28
+ triggerName,
29
+ auth: context.auth
30
+ }),
31
+ async run(context) {
32
+ return [context.payload.body];
33
+ }
34
+ });
@@ -0,0 +1,34 @@
1
+ import { createTrigger, Property, TriggerStrategy } from '@activepieces/pieces-framework';
2
+ import { coasyAuth } from '../..';
3
+ import { createCoasyTrigger, destroyCoasyTrigger, testCoasyTrigger } from '../common/triggers';
4
+
5
+ const triggerName = "GET_EVENTS";
6
+
7
+ export const getEvents = createTrigger({
8
+ auth: coasyAuth,
9
+ name: 'getEvents',
10
+ displayName: 'Get Events',
11
+ description: 'Get a list of all events.',
12
+ props: {},
13
+ sampleData: {},
14
+ type: TriggerStrategy.WEBHOOK,
15
+ onEnable: (context) => createCoasyTrigger({
16
+ triggerName,
17
+ webhookUrl: context.webhookUrl,
18
+ auth: context.auth,
19
+ filter: context.propsValue,
20
+ store: context.store
21
+ }),
22
+ onDisable: (context) => destroyCoasyTrigger({
23
+ triggerName,
24
+ auth: context.auth,
25
+ store: context.store
26
+ }),
27
+ test: (context) => testCoasyTrigger({
28
+ triggerName,
29
+ auth: context.auth
30
+ }),
31
+ async run(context) {
32
+ return [context.payload.body];
33
+ }
34
+ });
@@ -0,0 +1,34 @@
1
+ import { createTrigger, Property, TriggerStrategy } from '@activepieces/pieces-framework';
2
+ import { coasyAuth } from '../..';
3
+ import { createCoasyTrigger, destroyCoasyTrigger, testCoasyTrigger } from '../common/triggers';
4
+
5
+ const triggerName = "NEW_APP_USER_SIGN_UP";
6
+
7
+ export const newAppUserSignUp = createTrigger({
8
+ auth: coasyAuth,
9
+ name: 'newAppUserSignUp',
10
+ displayName: 'New App User Sign Up',
11
+ description: 'Triggers when a new app user sign up.',
12
+ props: {},
13
+ sampleData: {},
14
+ type: TriggerStrategy.WEBHOOK,
15
+ onEnable: (context) => createCoasyTrigger({
16
+ triggerName,
17
+ webhookUrl: context.webhookUrl,
18
+ auth: context.auth,
19
+ filter: context.propsValue,
20
+ store: context.store
21
+ }),
22
+ onDisable: (context) => destroyCoasyTrigger({
23
+ triggerName,
24
+ auth: context.auth,
25
+ store: context.store
26
+ }),
27
+ test: (context) => testCoasyTrigger({
28
+ triggerName,
29
+ auth: context.auth
30
+ }),
31
+ async run(context) {
32
+ return [context.payload.body];
33
+ }
34
+ });
@@ -1,6 +1,6 @@
1
1
  import { createTrigger, Property, TriggerStrategy } from '@activepieces/pieces-framework';
2
2
  import { coasyAuth } from '../..';
3
- import { createCoasyTrigger, destroyCoasyTrigger } from '../common/triggers';
3
+ import { createCoasyTrigger, destroyCoasyTrigger, testCoasyTrigger } from '../common/triggers';
4
4
 
5
5
  const triggerName = "NEW_AUTH_EVENT";
6
6
 
@@ -15,62 +15,78 @@ export const newAuthEvent = createTrigger({
15
15
  description: 'categories of trigger',
16
16
  required: true,
17
17
  options: {
18
- options: [{
19
- value: "CustomEmailSender",
20
- label: "Custom Email Sender"
21
- }, {
22
- value: "UserMigration",
23
- label: "User Migration"
24
- }, {
25
- value: "DefineAuthChallenge",
26
- label: "Define Auth Challenge"
27
- }, {
28
- value: "CreateAuthChallenge",
29
- label: "Create Auth Challenge"
30
- }, {
31
- value: "VerifyAuthChallengeResponse",
32
- label: "Verify Auth Challenge Response"
33
- }]
34
- }
18
+ options: [
19
+ {
20
+ value: 'CustomEmailSender',
21
+ label: 'Custom Email Sender',
22
+ },
23
+ {
24
+ value: 'UserMigration',
25
+ label: 'User Migration',
26
+ },
27
+ {
28
+ value: 'DefineAuthChallenge',
29
+ label: 'Define Auth Challenge',
30
+ },
31
+ {
32
+ value: 'CreateAuthChallenge',
33
+ label: 'Create Auth Challenge',
34
+ },
35
+ {
36
+ value: 'VerifyAuthChallengeResponse',
37
+ label: 'Verify Auth Challenge Response',
38
+ },
39
+ ],
40
+ },
35
41
  }),
36
42
  triggerNames: Property.StaticMultiSelectDropdown({
37
43
  displayName: 'Triggers',
38
44
  description: 'Select triggers to react on',
39
45
  required: true,
40
46
  options: {
41
- options: [{
42
- value: "SignUp",
43
- label: "Sign Up"
44
- }, {
45
- value: "ResendCode",
46
- label: "Resend Code"
47
- }, {
48
- value: "ForgotPassword",
49
- label: "Forgot Password"
50
- }, {
51
- value: "Authentication",
52
- label: "Authentication"
53
- }, {
54
- value: "ELSE",
55
- label: "Else"
56
- }]
57
- }
58
- })
47
+ options: [
48
+ {
49
+ value: 'SignUp',
50
+ label: 'Sign Up',
51
+ },
52
+ {
53
+ value: 'ResendCode',
54
+ label: 'Resend Code',
55
+ },
56
+ {
57
+ value: 'ForgotPassword',
58
+ label: 'Forgot Password',
59
+ },
60
+ {
61
+ value: 'Authentication',
62
+ label: 'Authentication',
63
+ },
64
+ {
65
+ value: 'ELSE',
66
+ label: 'Else',
67
+ },
68
+ ],
69
+ },
70
+ }),
59
71
  },
60
72
  sampleData: {},
61
73
  type: TriggerStrategy.WEBHOOK,
62
- onEnable : (context) => createCoasyTrigger({
74
+ onEnable: (context) => createCoasyTrigger({
63
75
  triggerName,
64
76
  webhookUrl: context.webhookUrl,
65
77
  auth: context.auth,
66
78
  filter: context.propsValue,
67
79
  store: context.store
68
80
  }),
69
- onDisable : (context) => destroyCoasyTrigger({
81
+ onDisable: (context) => destroyCoasyTrigger({
70
82
  triggerName,
71
83
  auth: context.auth,
72
84
  store: context.store
73
85
  }),
86
+ test: (context) => testCoasyTrigger({
87
+ triggerName,
88
+ auth: context.auth
89
+ }),
74
90
  async run(context) {
75
91
  return [context.payload.body];
76
92
  }
@@ -0,0 +1,34 @@
1
+ import { createTrigger, Property, TriggerStrategy } from '@activepieces/pieces-framework';
2
+ import { coasyAuth } from '../..';
3
+ import { createCoasyTrigger, destroyCoasyTrigger, testCoasyTrigger } from '../common/triggers';
4
+
5
+ const triggerName = "NEW_CUSTOMER";
6
+
7
+ export const newCustomer = createTrigger({
8
+ auth: coasyAuth,
9
+ name: 'newCustomer',
10
+ displayName: 'New Customer',
11
+ description: 'Triggers when a new Customer is created.',
12
+ props: {},
13
+ sampleData: {},
14
+ type: TriggerStrategy.WEBHOOK,
15
+ onEnable: (context) => createCoasyTrigger({
16
+ triggerName,
17
+ webhookUrl: context.webhookUrl,
18
+ auth: context.auth,
19
+ filter: context.propsValue,
20
+ store: context.store
21
+ }),
22
+ onDisable: (context) => destroyCoasyTrigger({
23
+ triggerName,
24
+ auth: context.auth,
25
+ store: context.store
26
+ }),
27
+ test: (context) => testCoasyTrigger({
28
+ triggerName,
29
+ auth: context.auth
30
+ }),
31
+ async run(context) {
32
+ return [context.payload.body];
33
+ }
34
+ });
@@ -0,0 +1,34 @@
1
+ import { createTrigger, Property, TriggerStrategy } from '@activepieces/pieces-framework';
2
+ import { coasyAuth } from '../..';
3
+ import { createCoasyTrigger, destroyCoasyTrigger, testCoasyTrigger } from '../common/triggers';
4
+
5
+ const triggerName = "NEW_EVENT_PARTICIPANT";
6
+
7
+ export const newEventParticipant = createTrigger({
8
+ auth: coasyAuth,
9
+ name: 'newEventParticipant',
10
+ displayName: 'New Event Participant',
11
+ description: 'Triggers when a new Event Participant is created.',
12
+ props: {},
13
+ sampleData: {},
14
+ type: TriggerStrategy.WEBHOOK,
15
+ onEnable: (context) => createCoasyTrigger({
16
+ triggerName,
17
+ webhookUrl: context.webhookUrl,
18
+ auth: context.auth,
19
+ filter: context.propsValue,
20
+ store: context.store
21
+ }),
22
+ onDisable: (context) => destroyCoasyTrigger({
23
+ triggerName,
24
+ auth: context.auth,
25
+ store: context.store
26
+ }),
27
+ test: (context) => testCoasyTrigger({
28
+ triggerName,
29
+ auth: context.auth
30
+ }),
31
+ async run(context) {
32
+ return [context.payload.body];
33
+ }
34
+ });
@@ -1,6 +1,6 @@
1
1
  import { createTrigger, Property, TriggerStrategy } from '@activepieces/pieces-framework';
2
2
  import { coasyAuth } from '../..';
3
- import { createCoasyTrigger, destroyCoasyTrigger } from '../common/triggers';
3
+ import { createCoasyTrigger, destroyCoasyTrigger, testCoasyTrigger } from '../common/triggers';
4
4
 
5
5
  const triggerName = "NEW_FUNNEL_PARTICIPANT";
6
6
 
@@ -18,18 +18,22 @@ export const newFunnelParticipant = createTrigger({
18
18
  },
19
19
  sampleData: {},
20
20
  type: TriggerStrategy.WEBHOOK,
21
- onEnable : (context) => createCoasyTrigger({
21
+ onEnable: (context) => createCoasyTrigger({
22
22
  triggerName,
23
23
  webhookUrl: context.webhookUrl,
24
24
  auth: context.auth,
25
25
  filter: context.propsValue,
26
26
  store: context.store
27
27
  }),
28
- onDisable : (context) => destroyCoasyTrigger({
28
+ onDisable: (context) => destroyCoasyTrigger({
29
29
  triggerName,
30
30
  auth: context.auth,
31
31
  store: context.store
32
32
  }),
33
+ test: (context) => testCoasyTrigger({
34
+ triggerName,
35
+ auth: context.auth
36
+ }),
33
37
  async run(context) {
34
38
  return [context.payload.body];
35
39
  }
@@ -0,0 +1,40 @@
1
+ import { createTrigger, Property, TriggerStrategy } from '@activepieces/pieces-framework';
2
+ import { coasyAuth } from '../..';
3
+ import { createCoasyTrigger, destroyCoasyTrigger, testCoasyTrigger } from '../common/triggers';
4
+
5
+ const triggerName = "NEW_LEAD";
6
+
7
+ export const newLead = createTrigger({
8
+ auth: coasyAuth,
9
+ name: 'newLead',
10
+ displayName: 'New Lead',
11
+ description: 'Triggers when a new lead is created.',
12
+ props: {
13
+ funnelId: Property.ShortText({
14
+ displayName: 'Funnel ID',
15
+ description: 'ID of funnel to react to',
16
+ required: false
17
+ })
18
+ },
19
+ sampleData: {},
20
+ type: TriggerStrategy.WEBHOOK,
21
+ onEnable: (context) => createCoasyTrigger({
22
+ triggerName,
23
+ webhookUrl: context.webhookUrl,
24
+ auth: context.auth,
25
+ filter: context.propsValue,
26
+ store: context.store
27
+ }),
28
+ onDisable: (context) => destroyCoasyTrigger({
29
+ triggerName,
30
+ auth: context.auth,
31
+ store: context.store
32
+ }),
33
+ test: (context) => testCoasyTrigger({
34
+ triggerName,
35
+ auth: context.auth
36
+ }),
37
+ async run(context) {
38
+ return [context.payload.body];
39
+ }
40
+ });
@@ -0,0 +1,34 @@
1
+ import { createTrigger, Property, TriggerStrategy } from '@activepieces/pieces-framework';
2
+ import { coasyAuth } from '../..';
3
+ import { createCoasyTrigger, destroyCoasyTrigger, testCoasyTrigger } from '../common/triggers';
4
+
5
+ const triggerName = "NEW_MEMBERSHIP";
6
+
7
+ export const newMembership = createTrigger({
8
+ auth: coasyAuth,
9
+ name: 'newMembership',
10
+ displayName: 'New Membership',
11
+ description: 'Triggers when a new membership is created.',
12
+ props: {},
13
+ sampleData: {},
14
+ type: TriggerStrategy.WEBHOOK,
15
+ onEnable: (context) => createCoasyTrigger({
16
+ triggerName,
17
+ webhookUrl: context.webhookUrl,
18
+ auth: context.auth,
19
+ filter: context.propsValue,
20
+ store: context.store
21
+ }),
22
+ onDisable: (context) => destroyCoasyTrigger({
23
+ triggerName,
24
+ auth: context.auth,
25
+ store: context.store
26
+ }),
27
+ test: (context) => testCoasyTrigger({
28
+ triggerName,
29
+ auth: context.auth
30
+ }),
31
+ async run(context) {
32
+ return [context.payload.body];
33
+ }
34
+ });
@@ -0,0 +1,41 @@
1
+ import { createTrigger, Property, TriggerStrategy } from '@activepieces/pieces-framework';
2
+ import { coasyAuth } from '../..';
3
+ import { createCoasyTrigger, destroyCoasyTrigger, testCoasyTrigger } from '../common/triggers';
4
+
5
+ const triggerName = "NEW_ORDER_ITEM";
6
+
7
+ export const newOrderItem = createTrigger({
8
+ auth: coasyAuth,
9
+ name: 'newOrderItem',
10
+ displayName: 'New Order Item',
11
+ description: 'Triggers for each item in a new Order.',
12
+ props: {
13
+ offerIds: Property.Array({
14
+ displayName: 'Offer IDs',
15
+ description: 'IDs of offer to react to',
16
+ required: false
17
+ })
18
+ },
19
+
20
+ sampleData: {},
21
+ type: TriggerStrategy.WEBHOOK,
22
+ onEnable: (context) => createCoasyTrigger({
23
+ triggerName,
24
+ webhookUrl: context.webhookUrl,
25
+ auth: context.auth,
26
+ filter: context.propsValue,
27
+ store: context.store
28
+ }),
29
+ onDisable: (context) => destroyCoasyTrigger({
30
+ triggerName,
31
+ auth: context.auth,
32
+ store: context.store
33
+ }),
34
+ test: (context) => testCoasyTrigger({
35
+ triggerName,
36
+ auth: context.auth
37
+ }),
38
+ async run(context) {
39
+ return [context.payload.body];
40
+ }
41
+ });
@@ -0,0 +1,34 @@
1
+ import { createTrigger, Property, TriggerStrategy } from '@activepieces/pieces-framework';
2
+ import { coasyAuth } from '../..';
3
+ import { createCoasyTrigger, destroyCoasyTrigger, testCoasyTrigger } from '../common/triggers';
4
+
5
+ const triggerName = "NEW_ORDER";
6
+
7
+ export const newOrder = createTrigger({
8
+ auth: coasyAuth,
9
+ name: 'newOrder',
10
+ displayName: 'New Order',
11
+ description: 'Triggers when a new order is created.',
12
+ props: {},
13
+ sampleData: {},
14
+ type: TriggerStrategy.WEBHOOK,
15
+ onEnable: (context) => createCoasyTrigger({
16
+ triggerName,
17
+ webhookUrl: context.webhookUrl,
18
+ auth: context.auth,
19
+ filter: context.propsValue,
20
+ store: context.store
21
+ }),
22
+ onDisable: (context) => destroyCoasyTrigger({
23
+ triggerName,
24
+ auth: context.auth,
25
+ store: context.store
26
+ }),
27
+ test: (context) => testCoasyTrigger({
28
+ triggerName,
29
+ auth: context.auth
30
+ }),
31
+ async run(context) {
32
+ return [context.payload.body];
33
+ }
34
+ });
@@ -0,0 +1,34 @@
1
+ import { createTrigger, Property, TriggerStrategy } from '@activepieces/pieces-framework';
2
+ import { coasyAuth } from '../..';
3
+ import { createCoasyTrigger, destroyCoasyTrigger, testCoasyTrigger } from '../common/triggers';
4
+
5
+ const triggerName = "NEW_SUBSCRIPTION";
6
+
7
+ export const newSubscription = createTrigger({
8
+ auth: coasyAuth,
9
+ name: 'newSubscription',
10
+ displayName: 'New Subscription',
11
+ description: 'Triggers when a new subscription is created.',
12
+ props: {},
13
+ sampleData: {},
14
+ type: TriggerStrategy.WEBHOOK,
15
+ onEnable: (context) => createCoasyTrigger({
16
+ triggerName,
17
+ webhookUrl: context.webhookUrl,
18
+ auth: context.auth,
19
+ filter: context.propsValue,
20
+ store: context.store
21
+ }),
22
+ onDisable: (context) => destroyCoasyTrigger({
23
+ triggerName,
24
+ auth: context.auth,
25
+ store: context.store
26
+ }),
27
+ test: (context) => testCoasyTrigger({
28
+ triggerName,
29
+ auth: context.auth
30
+ }),
31
+ async run(context) {
32
+ return [context.payload.body];
33
+ }
34
+ });
@@ -1,6 +1,6 @@
1
1
  import { createTrigger, Property, TriggerStrategy } from '@activepieces/pieces-framework';
2
2
  import { coasyAuth } from '../..';
3
- import { createCoasyTrigger, destroyCoasyTrigger } from '../common/triggers';
3
+ import { createCoasyTrigger, destroyCoasyTrigger, testCoasyTrigger } from '../common/triggers';
4
4
 
5
5
  const triggerName = "NEW_WEBINAR_PARTICIPANT";
6
6
 
@@ -44,6 +44,10 @@ export const newWebinarParticipant = createTrigger({
44
44
  auth: context.auth,
45
45
  store: context.store
46
46
  }),
47
+ test: (context) => testCoasyTrigger({
48
+ triggerName,
49
+ auth: context.auth
50
+ }),
47
51
  async run(context) {
48
52
  return [context.payload.body];
49
53
  }
@@ -0,0 +1,61 @@
1
+ import { createTrigger, Property, TriggerStrategy } from '@activepieces/pieces-framework';
2
+ import { coasyAuth } from '../..';
3
+ import { createCoasyTrigger, destroyCoasyTrigger, testCoasyTrigger } from '../common/triggers';
4
+
5
+ const triggerName = "WEBINAR_PARTICIPANT_ATTEND";
6
+
7
+ export const webinarParticipantAttend = createTrigger({
8
+ auth: coasyAuth,
9
+ name: 'webinarParticipantAttend',
10
+ displayName: 'Webinar Participant Attend',
11
+ description: 'Triggers when a webinar participant has attended or not attended',
12
+ props: {
13
+ webinarIds: Property.Array({
14
+ displayName: 'Webinar IDs',
15
+ description: 'IDs of webinar to react to',
16
+ required: false
17
+ }),
18
+ status: Property.StaticDropdown({
19
+ displayName: 'Status',
20
+ description: 'filter only participants by',
21
+ required: false,
22
+ options: {
23
+ options: [
24
+ {
25
+ label: 'Upcoming',
26
+ value: 'UPCOMING'
27
+ },
28
+ {
29
+ label: 'Attented',
30
+ value: 'ATTENTED'
31
+ },
32
+ {
33
+ label: 'Not Attented',
34
+ value: 'NOT_ATTENTED'
35
+ }
36
+ ]
37
+ }
38
+ })
39
+ },
40
+ sampleData: {},
41
+ type: TriggerStrategy.WEBHOOK,
42
+ onEnable: (context) => createCoasyTrigger({
43
+ triggerName,
44
+ webhookUrl: context.webhookUrl,
45
+ auth: context.auth,
46
+ filter: context.propsValue,
47
+ store: context.store
48
+ }),
49
+ onDisable: (context) => destroyCoasyTrigger({
50
+ triggerName,
51
+ auth: context.auth,
52
+ store: context.store
53
+ }),
54
+ test: (context) => testCoasyTrigger({
55
+ triggerName,
56
+ auth: context.auth
57
+ }),
58
+ async run(context) {
59
+ return [context.payload.body];
60
+ }
61
+ });
@@ -0,0 +1,61 @@
1
+ import { createTrigger, Property, TriggerStrategy } from '@activepieces/pieces-framework';
2
+ import { coasyAuth } from '../..';
3
+ import { createCoasyTrigger, destroyCoasyTrigger, testCoasyTrigger } from '../common/triggers';
4
+
5
+ const triggerName = "WEBINAR_PARTICIPANT_REMINDER";
6
+
7
+ export const webinarParticipantReminder = createTrigger({
8
+ auth: coasyAuth,
9
+ name: 'webinarParticipantReminder',
10
+ displayName: 'Webinar Participant Reminder',
11
+ description: 'Triggers when a webinar participant is reminded',
12
+ props: {
13
+ webinarIds: Property.Array({
14
+ displayName: 'Webinar IDs',
15
+ description: 'IDs of webinar to react to',
16
+ required: false
17
+ }),
18
+ status: Property.StaticDropdown({
19
+ displayName: 'Status',
20
+ description: 'filter only participants by',
21
+ required: false,
22
+ options: {
23
+ options: [
24
+ {
25
+ label: 'Upcoming',
26
+ value: 'UPCOMING'
27
+ },
28
+ {
29
+ label: 'Attented',
30
+ value: 'ATTENTED'
31
+ },
32
+ {
33
+ label: 'Not Attented',
34
+ value: 'NOT_ATTENTED'
35
+ }
36
+ ]
37
+ }
38
+ })
39
+ },
40
+ sampleData: {},
41
+ type: TriggerStrategy.WEBHOOK,
42
+ onEnable: (context) => createCoasyTrigger({
43
+ triggerName,
44
+ webhookUrl: context.webhookUrl,
45
+ auth: context.auth,
46
+ filter: context.propsValue,
47
+ store: context.store
48
+ }),
49
+ onDisable: (context) => destroyCoasyTrigger({
50
+ triggerName,
51
+ auth: context.auth,
52
+ store: context.store
53
+ }),
54
+ test: (context) => testCoasyTrigger({
55
+ triggerName,
56
+ auth: context.auth
57
+ }),
58
+ async run(context) {
59
+ return [context.payload.body];
60
+ }
61
+ });