@activepieces/piece-mailgun 0.0.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/package.json +16 -0
- package/src/i18n/fr.json +126 -0
- package/src/i18n/translation.json +126 -0
- package/src/index.d.ts +9 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +109 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/add-mailing-list-member.d.ts +15 -0
- package/src/lib/actions/add-mailing-list-member.d.ts.map +1 -0
- package/src/lib/actions/add-mailing-list-member.js +76 -0
- package/src/lib/actions/add-mailing-list-member.js.map +1 -0
- package/src/lib/actions/get-domain-stats.d.ts +12 -0
- package/src/lib/actions/get-domain-stats.d.ts.map +1 -0
- package/src/lib/actions/get-domain-stats.js +117 -0
- package/src/lib/actions/get-domain-stats.js.map +1 -0
- package/src/lib/actions/get-events.d.ts +15 -0
- package/src/lib/actions/get-events.d.ts.map +1 -0
- package/src/lib/actions/get-events.js +141 -0
- package/src/lib/actions/get-events.js.map +1 -0
- package/src/lib/actions/list-bounces.d.ts +11 -0
- package/src/lib/actions/list-bounces.d.ts.map +1 -0
- package/src/lib/actions/list-bounces.js +49 -0
- package/src/lib/actions/list-bounces.js.map +1 -0
- package/src/lib/actions/send-email.d.ts +18 -0
- package/src/lib/actions/send-email.d.ts.map +1 -0
- package/src/lib/actions/send-email.js +93 -0
- package/src/lib/actions/send-email.js.map +1 -0
- package/src/lib/actions/validate-email.d.ts +8 -0
- package/src/lib/actions/validate-email.d.ts.map +1 -0
- package/src/lib/actions/validate-email.js +54 -0
- package/src/lib/actions/validate-email.js.map +1 -0
- package/src/lib/common/index.d.ts +39 -0
- package/src/lib/common/index.d.ts.map +1 -0
- package/src/lib/common/index.js +165 -0
- package/src/lib/common/index.js.map +1 -0
- package/src/lib/triggers/common.d.ts +42 -0
- package/src/lib/triggers/common.d.ts.map +1 -0
- package/src/lib/triggers/common.js +102 -0
- package/src/lib/triggers/common.js.map +1 -0
- package/src/lib/triggers/new-bounce-event.d.ts +34 -0
- package/src/lib/triggers/new-bounce-event.d.ts.map +1 -0
- package/src/lib/triggers/new-bounce-event.js +29 -0
- package/src/lib/triggers/new-bounce-event.js.map +1 -0
- package/src/lib/triggers/new-click-event.d.ts +34 -0
- package/src/lib/triggers/new-click-event.d.ts.map +1 -0
- package/src/lib/triggers/new-click-event.js +29 -0
- package/src/lib/triggers/new-click-event.js.map +1 -0
- package/src/lib/triggers/new-complaint-event.d.ts +34 -0
- package/src/lib/triggers/new-complaint-event.d.ts.map +1 -0
- package/src/lib/triggers/new-complaint-event.js +24 -0
- package/src/lib/triggers/new-complaint-event.js.map +1 -0
- package/src/lib/triggers/new-delivery-event.d.ts +34 -0
- package/src/lib/triggers/new-delivery-event.d.ts.map +1 -0
- package/src/lib/triggers/new-delivery-event.js +26 -0
- package/src/lib/triggers/new-delivery-event.js.map +1 -0
- package/src/lib/triggers/new-failed-delivery-event.d.ts +34 -0
- package/src/lib/triggers/new-failed-delivery-event.d.ts.map +1 -0
- package/src/lib/triggers/new-failed-delivery-event.js +29 -0
- package/src/lib/triggers/new-failed-delivery-event.js.map +1 -0
- package/src/lib/triggers/new-open-event.d.ts +34 -0
- package/src/lib/triggers/new-open-event.d.ts.map +1 -0
- package/src/lib/triggers/new-open-event.js +28 -0
- package/src/lib/triggers/new-open-event.js.map +1 -0
- package/src/lib/triggers/new-unsubscribe-event.d.ts +34 -0
- package/src/lib/triggers/new-unsubscribe-event.d.ts.map +1 -0
- package/src/lib/triggers/new-unsubscribe-event.js +28 -0
- package/src/lib/triggers/new-unsubscribe-event.js.map +1 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mailgunCommon = void 0;
|
|
4
|
+
exports.verifyMailgunSignature = verifyMailgunSignature;
|
|
5
|
+
exports.mailgunApiCall = mailgunApiCall;
|
|
6
|
+
exports.subscribeWebhook = subscribeWebhook;
|
|
7
|
+
exports.unsubscribeWebhook = unsubscribeWebhook;
|
|
8
|
+
exports.mailgunApiCallAbsoluteUrl = mailgunApiCallAbsoluteUrl;
|
|
9
|
+
const tslib_1 = require("tslib");
|
|
10
|
+
const crypto_1 = require("crypto");
|
|
11
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
12
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
13
|
+
const shared_1 = require("@activepieces/shared");
|
|
14
|
+
const __1 = require("../..");
|
|
15
|
+
function verifyMailgunSignature(apiKey, timestamp, token, signature) {
|
|
16
|
+
const expected = (0, crypto_1.createHmac)('sha256', apiKey)
|
|
17
|
+
.update(timestamp + token)
|
|
18
|
+
.digest('hex');
|
|
19
|
+
const expectedBuf = Buffer.from(expected);
|
|
20
|
+
const signatureBuf = Buffer.from(signature);
|
|
21
|
+
if (expectedBuf.length !== signatureBuf.length) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
return (0, crypto_1.timingSafeEqual)(expectedBuf, signatureBuf);
|
|
25
|
+
}
|
|
26
|
+
function mailgunApiCall(_a) {
|
|
27
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ apiKey, region, method, path, body, queryParams, headers, }) {
|
|
28
|
+
return yield pieces_common_1.httpClient.sendRequest({
|
|
29
|
+
method,
|
|
30
|
+
url: `${getBaseUrl(region)}${path}`,
|
|
31
|
+
authentication: {
|
|
32
|
+
type: pieces_common_1.AuthenticationType.BASIC,
|
|
33
|
+
username: 'api',
|
|
34
|
+
password: apiKey,
|
|
35
|
+
},
|
|
36
|
+
queryParams,
|
|
37
|
+
body,
|
|
38
|
+
headers,
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function subscribeWebhook(_a) {
|
|
43
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ apiKey, region, domain, eventType, webhookUrl, }) {
|
|
44
|
+
const formHeaders = { 'Content-Type': 'application/x-www-form-urlencoded' };
|
|
45
|
+
const { error } = yield (0, shared_1.tryCatch)(() => mailgunApiCall({
|
|
46
|
+
apiKey,
|
|
47
|
+
region,
|
|
48
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
49
|
+
path: `/v3/domains/${domain}/webhooks`,
|
|
50
|
+
body: new URLSearchParams({ id: eventType, url: webhookUrl }).toString(),
|
|
51
|
+
headers: formHeaders,
|
|
52
|
+
}));
|
|
53
|
+
if (error) {
|
|
54
|
+
// Webhook already exists — update it with PUT instead
|
|
55
|
+
yield mailgunApiCall({
|
|
56
|
+
apiKey,
|
|
57
|
+
region,
|
|
58
|
+
method: pieces_common_1.HttpMethod.PUT,
|
|
59
|
+
path: `/v3/domains/${domain}/webhooks/${eventType}`,
|
|
60
|
+
body: new URLSearchParams({ url: webhookUrl }).toString(),
|
|
61
|
+
headers: formHeaders,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function unsubscribeWebhook(_a) {
|
|
67
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ apiKey, region, domain, eventType, }) {
|
|
68
|
+
const { error } = yield (0, shared_1.tryCatch)(() => mailgunApiCall({
|
|
69
|
+
apiKey,
|
|
70
|
+
region,
|
|
71
|
+
method: pieces_common_1.HttpMethod.DELETE,
|
|
72
|
+
path: `/v3/domains/${domain}/webhooks/${eventType}`,
|
|
73
|
+
}));
|
|
74
|
+
// 404 means the webhook was already removed — ignore it
|
|
75
|
+
if (error && error instanceof pieces_common_1.HttpError && error.response.status === 404) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (error) {
|
|
79
|
+
throw error;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function mailgunApiCallAbsoluteUrl(_a) {
|
|
84
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ apiKey, url, }) {
|
|
85
|
+
return yield pieces_common_1.httpClient.sendRequest({
|
|
86
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
87
|
+
url,
|
|
88
|
+
authentication: {
|
|
89
|
+
type: pieces_common_1.AuthenticationType.BASIC,
|
|
90
|
+
username: 'api',
|
|
91
|
+
password: apiKey,
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
exports.mailgunCommon = {
|
|
97
|
+
domainDropdown: pieces_framework_1.Property.Dropdown({
|
|
98
|
+
displayName: 'Domain',
|
|
99
|
+
description: 'Select the Mailgun domain to use',
|
|
100
|
+
refreshers: [],
|
|
101
|
+
required: true,
|
|
102
|
+
auth: __1.mailgunAuth,
|
|
103
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
104
|
+
if (!auth) {
|
|
105
|
+
return {
|
|
106
|
+
disabled: true,
|
|
107
|
+
options: [],
|
|
108
|
+
placeholder: 'Please connect your Mailgun account first',
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
const response = yield mailgunApiCall({
|
|
112
|
+
apiKey: auth.props.api_key,
|
|
113
|
+
region: auth.props.region,
|
|
114
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
115
|
+
path: '/v3/domains',
|
|
116
|
+
queryParams: { limit: '1000' },
|
|
117
|
+
});
|
|
118
|
+
return {
|
|
119
|
+
disabled: false,
|
|
120
|
+
options: response.body.items.map((domain) => ({
|
|
121
|
+
label: `${domain.name} (${domain.state})`,
|
|
122
|
+
value: domain.name,
|
|
123
|
+
})),
|
|
124
|
+
};
|
|
125
|
+
}),
|
|
126
|
+
}),
|
|
127
|
+
mailingListDropdown: pieces_framework_1.Property.Dropdown({
|
|
128
|
+
displayName: 'Mailing List',
|
|
129
|
+
description: 'Select the mailing list',
|
|
130
|
+
refreshers: [],
|
|
131
|
+
required: true,
|
|
132
|
+
auth: __1.mailgunAuth,
|
|
133
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
134
|
+
if (!auth) {
|
|
135
|
+
return {
|
|
136
|
+
disabled: true,
|
|
137
|
+
options: [],
|
|
138
|
+
placeholder: 'Please connect your Mailgun account first',
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
const response = yield mailgunApiCall({
|
|
142
|
+
apiKey: auth.props.api_key,
|
|
143
|
+
region: auth.props.region,
|
|
144
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
145
|
+
path: '/v3/lists/pages',
|
|
146
|
+
queryParams: { limit: '100' },
|
|
147
|
+
});
|
|
148
|
+
return {
|
|
149
|
+
disabled: false,
|
|
150
|
+
options: response.body.items.map((list) => ({
|
|
151
|
+
label: list.name
|
|
152
|
+
? `${list.name} (${list.address})`
|
|
153
|
+
: list.address,
|
|
154
|
+
value: list.address,
|
|
155
|
+
})),
|
|
156
|
+
};
|
|
157
|
+
}),
|
|
158
|
+
}),
|
|
159
|
+
};
|
|
160
|
+
function getBaseUrl(region) {
|
|
161
|
+
return region === 'eu'
|
|
162
|
+
? 'https://api.eu.mailgun.net'
|
|
163
|
+
: 'https://api.mailgun.net';
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/common/index.ts"],"names":[],"mappings":";;;AAaA,wDAeC;AAED,wCA6BC;AAED,4CAoCC;AAED,gDA2BC;AAED,8DAgBC;;AAhJD,mCAAqD;AACrD,+DAOqC;AACrC,qEAA0D;AAC1D,iDAAgD;AAChD,6BAAoC;AAEpC,SAAgB,sBAAsB,CACpC,MAAc,EACd,SAAiB,EACjB,KAAa,EACb,SAAiB;IAEjB,MAAM,QAAQ,GAAG,IAAA,mBAAU,EAAC,QAAQ,EAAE,MAAM,CAAC;SAC1C,MAAM,CAAC,SAAS,GAAG,KAAK,CAAC;SACzB,MAAM,CAAC,KAAK,CAAC,CAAC;IACjB,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAA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AAM,QAAQ,GAAG,MAAM,cAAc,CAElC;gBACD,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO;gBAC1B,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;gBACzB,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,IAAI,EAAE,iBAAiB;gBACvB,WAAW,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE;aAC9B,CAAC,CAAC;YACH,OAAO;gBACL,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;oBAC1C,KAAK,EAAE,IAAI,CAAC,IAAI;wBACd,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,OAAO,GAAG;wBAClC,CAAC,CAAC,IAAI,CAAC,OAAO;oBAChB,KAAK,EAAE,IAAI,CAAC,OAAO;iBACpB,CAAC,CAAC;aACJ,CAAC;QACJ,CAAC,CAAA;KACF,CAAC;CACH,CAAC;AAEF,SAAS,UAAU,CAAC,MAAc;IAChC,OAAO,MAAM,KAAK,IAAI;QACpB,CAAC,CAAC,4BAA4B;QAC9B,CAAC,CAAC,yBAAyB,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
+
export declare function createMailgunWebhookTrigger({ name, displayName, description, eventType, testEventFilter, sampleData, }: {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
description: string;
|
|
6
|
+
eventType: string;
|
|
7
|
+
testEventFilter: Record<string, string>;
|
|
8
|
+
sampleData: Record<string, unknown>;
|
|
9
|
+
}): import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
10
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
11
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
12
|
+
}>, {
|
|
13
|
+
domain: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
14
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
15
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
16
|
+
}>>;
|
|
17
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
18
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
19
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
20
|
+
}>, {
|
|
21
|
+
domain: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
22
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
23
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
24
|
+
}>>;
|
|
25
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
26
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
27
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
28
|
+
}>, {
|
|
29
|
+
domain: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
30
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
31
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
32
|
+
}>>;
|
|
33
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
34
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
35
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
36
|
+
}>, {
|
|
37
|
+
domain: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
38
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
39
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
40
|
+
}>>;
|
|
41
|
+
}>;
|
|
42
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAiChF,wBAAgB,2BAA2B,CAAC,EAC1C,IAAI,EACJ,WAAW,EACX,WAAW,EACX,SAAS,EACT,eAAe,EACf,UAAU,GACX,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFA"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createMailgunWebhookTrigger = createMailgunWebhookTrigger;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const __1 = require("../..");
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
9
|
+
function flattenEventData(eventData) {
|
|
10
|
+
const result = {};
|
|
11
|
+
for (const [key, value] of Object.entries(eventData)) {
|
|
12
|
+
const flatKey = key.replace(/-/g, '_');
|
|
13
|
+
if (value === null || value === undefined) {
|
|
14
|
+
result[flatKey] = null;
|
|
15
|
+
}
|
|
16
|
+
else if (Array.isArray(value)) {
|
|
17
|
+
result[flatKey] = value
|
|
18
|
+
.map((v) => (typeof v === 'object' ? JSON.stringify(v) : String(v)))
|
|
19
|
+
.join(', ');
|
|
20
|
+
}
|
|
21
|
+
else if (typeof value === 'object') {
|
|
22
|
+
const nested = flattenEventData(value);
|
|
23
|
+
for (const [nestedKey, nestedValue] of Object.entries(nested)) {
|
|
24
|
+
result[`${flatKey}_${nestedKey}`] = nestedValue;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
result[flatKey] = value;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
33
|
+
function createMailgunWebhookTrigger({ name, displayName, description, eventType, testEventFilter, sampleData, }) {
|
|
34
|
+
return (0, pieces_framework_1.createTrigger)({
|
|
35
|
+
auth: __1.mailgunAuth,
|
|
36
|
+
name,
|
|
37
|
+
displayName,
|
|
38
|
+
description,
|
|
39
|
+
props: {
|
|
40
|
+
domain: common_1.mailgunCommon.domainDropdown,
|
|
41
|
+
},
|
|
42
|
+
sampleData,
|
|
43
|
+
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
44
|
+
onEnable(context) {
|
|
45
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const auth = context.auth;
|
|
47
|
+
yield (0, common_1.subscribeWebhook)({
|
|
48
|
+
apiKey: auth.props.api_key,
|
|
49
|
+
region: auth.props.region,
|
|
50
|
+
domain: context.propsValue.domain,
|
|
51
|
+
eventType,
|
|
52
|
+
webhookUrl: context.webhookUrl,
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
onDisable(context) {
|
|
57
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
const auth = context.auth;
|
|
59
|
+
yield (0, common_1.unsubscribeWebhook)({
|
|
60
|
+
apiKey: auth.props.api_key,
|
|
61
|
+
region: auth.props.region,
|
|
62
|
+
domain: context.propsValue.domain,
|
|
63
|
+
eventType,
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
},
|
|
67
|
+
run(context) {
|
|
68
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
const payload = context.payload.body;
|
|
70
|
+
if (!payload.signature) {
|
|
71
|
+
return [];
|
|
72
|
+
}
|
|
73
|
+
const isValid = (0, common_1.verifyMailgunSignature)(context.auth.props.api_key, payload.signature.timestamp, payload.signature.token, payload.signature.signature);
|
|
74
|
+
if (!isValid) {
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
77
|
+
const eventData = payload['event-data'];
|
|
78
|
+
if (!eventData) {
|
|
79
|
+
return [payload];
|
|
80
|
+
}
|
|
81
|
+
return [flattenEventData(eventData)];
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
test(context) {
|
|
85
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
86
|
+
const auth = context.auth;
|
|
87
|
+
const response = yield (0, common_1.mailgunApiCall)({
|
|
88
|
+
apiKey: auth.props.api_key,
|
|
89
|
+
region: auth.props.region,
|
|
90
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
91
|
+
path: `/v3/${context.propsValue.domain}/events`,
|
|
92
|
+
queryParams: Object.assign(Object.assign({}, testEventFilter), { limit: '5' }),
|
|
93
|
+
});
|
|
94
|
+
if (!response.body.items || response.body.items.length === 0) {
|
|
95
|
+
return [sampleData];
|
|
96
|
+
}
|
|
97
|
+
return response.body.items.map((item) => flattenEventData(item));
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0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@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const newBounceEvent: import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
3
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
4
|
+
}>, {
|
|
5
|
+
domain: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
6
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
7
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
8
|
+
}>>;
|
|
9
|
+
}> | import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.POLLING, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
10
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
11
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
12
|
+
}>, {
|
|
13
|
+
domain: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
14
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
15
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
16
|
+
}>>;
|
|
17
|
+
}> | import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
18
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
19
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
20
|
+
}>, {
|
|
21
|
+
domain: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
22
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
23
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
24
|
+
}>>;
|
|
25
|
+
}> | import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
26
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
27
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
28
|
+
}>, {
|
|
29
|
+
domain: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
30
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
31
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
32
|
+
}>>;
|
|
33
|
+
}>;
|
|
34
|
+
//# sourceMappingURL=new-bounce-event.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-bounce-event.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/new-bounce-event.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBzB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.newBounceEvent = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
exports.newBounceEvent = (0, common_1.createMailgunWebhookTrigger)({
|
|
6
|
+
name: 'new_bounce_event',
|
|
7
|
+
displayName: 'New Bounce Event',
|
|
8
|
+
description: 'Triggers when an email permanently fails to deliver (hard bounce) in Mailgun',
|
|
9
|
+
eventType: 'permanent_fail',
|
|
10
|
+
testEventFilter: { event: 'failed', severity: 'permanent' },
|
|
11
|
+
sampleData: {
|
|
12
|
+
event: 'failed',
|
|
13
|
+
id: 'abc123',
|
|
14
|
+
timestamp: 1710000000,
|
|
15
|
+
recipient: 'bounce@example.com',
|
|
16
|
+
domain: 'example.com',
|
|
17
|
+
severity: 'permanent',
|
|
18
|
+
reason: 'bounce',
|
|
19
|
+
log_level: 'error',
|
|
20
|
+
message_headers_message_id: '20240310120000.abc123@example.com',
|
|
21
|
+
message_headers_from: 'sender@example.com',
|
|
22
|
+
message_headers_to: 'bounce@example.com',
|
|
23
|
+
message_headers_subject: 'Test email',
|
|
24
|
+
delivery_status_code: 550,
|
|
25
|
+
delivery_status_message: 'Mailbox not found',
|
|
26
|
+
delivery_status_description: 'The email account does not exist',
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=new-bounce-event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-bounce-event.js","sourceRoot":"","sources":["../../../../src/lib/triggers/new-bounce-event.ts"],"names":[],"mappings":";;;AAAA,qCAAuD;AAE1C,QAAA,cAAc,GAAG,IAAA,oCAA2B,EAAC;IACxD,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EACT,8EAA8E;IAChF,SAAS,EAAE,gBAAgB;IAC3B,eAAe,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE;IAC3D,UAAU,EAAE;QACV,KAAK,EAAE,QAAQ;QACf,EAAE,EAAE,QAAQ;QACZ,SAAS,EAAE,UAAU;QACrB,SAAS,EAAE,oBAAoB;QAC/B,MAAM,EAAE,aAAa;QACrB,QAAQ,EAAE,WAAW;QACrB,MAAM,EAAE,QAAQ;QAChB,SAAS,EAAE,OAAO;QAClB,0BAA0B,EAAE,mCAAmC;QAC/D,oBAAoB,EAAE,oBAAoB;QAC1C,kBAAkB,EAAE,oBAAoB;QACxC,uBAAuB,EAAE,YAAY;QACrC,oBAAoB,EAAE,GAAG;QACzB,uBAAuB,EAAE,mBAAmB;QAC5C,2BAA2B,EAAE,kCAAkC;KAChE;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const newClickEvent: import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
3
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
4
|
+
}>, {
|
|
5
|
+
domain: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
6
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
7
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
8
|
+
}>>;
|
|
9
|
+
}> | import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.POLLING, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
10
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
11
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
12
|
+
}>, {
|
|
13
|
+
domain: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
14
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
15
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
16
|
+
}>>;
|
|
17
|
+
}> | import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
18
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
19
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
20
|
+
}>, {
|
|
21
|
+
domain: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
22
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
23
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
24
|
+
}>>;
|
|
25
|
+
}> | import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
26
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
27
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
28
|
+
}>, {
|
|
29
|
+
domain: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
30
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
31
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
32
|
+
}>>;
|
|
33
|
+
}>;
|
|
34
|
+
//# sourceMappingURL=new-click-event.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-click-event.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/new-click-event.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBxB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.newClickEvent = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
exports.newClickEvent = (0, common_1.createMailgunWebhookTrigger)({
|
|
6
|
+
name: 'new_click_event',
|
|
7
|
+
displayName: 'New Click Event',
|
|
8
|
+
description: 'Triggers when a recipient clicks a tracked link in an email in Mailgun',
|
|
9
|
+
eventType: 'clicked',
|
|
10
|
+
testEventFilter: { event: 'clicked' },
|
|
11
|
+
sampleData: {
|
|
12
|
+
event: 'clicked',
|
|
13
|
+
id: 'ghi456',
|
|
14
|
+
timestamp: 1710000000,
|
|
15
|
+
recipient: 'user@example.com',
|
|
16
|
+
domain: 'example.com',
|
|
17
|
+
log_level: 'info',
|
|
18
|
+
url: 'https://example.com/landing',
|
|
19
|
+
ip: '192.168.1.1',
|
|
20
|
+
client_info_client_name: 'Chrome',
|
|
21
|
+
client_info_client_os: 'macOS',
|
|
22
|
+
client_info_device_type: 'desktop',
|
|
23
|
+
message_headers_message_id: '20240310120000.ghi456@example.com',
|
|
24
|
+
message_headers_from: 'sender@example.com',
|
|
25
|
+
message_headers_to: 'user@example.com',
|
|
26
|
+
message_headers_subject: 'Check out our new feature',
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=new-click-event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-click-event.js","sourceRoot":"","sources":["../../../../src/lib/triggers/new-click-event.ts"],"names":[],"mappings":";;;AAAA,qCAAuD;AAE1C,QAAA,aAAa,GAAG,IAAA,oCAA2B,EAAC;IACvD,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,iBAAiB;IAC9B,WAAW,EACT,wEAAwE;IAC1E,SAAS,EAAE,SAAS;IACpB,eAAe,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;IACrC,UAAU,EAAE;QACV,KAAK,EAAE,SAAS;QAChB,EAAE,EAAE,QAAQ;QACZ,SAAS,EAAE,UAAU;QACrB,SAAS,EAAE,kBAAkB;QAC7B,MAAM,EAAE,aAAa;QACrB,SAAS,EAAE,MAAM;QACjB,GAAG,EAAE,6BAA6B;QAClC,EAAE,EAAE,aAAa;QACjB,uBAAuB,EAAE,QAAQ;QACjC,qBAAqB,EAAE,OAAO;QAC9B,uBAAuB,EAAE,SAAS;QAClC,0BAA0B,EAAE,mCAAmC;QAC/D,oBAAoB,EAAE,oBAAoB;QAC1C,kBAAkB,EAAE,kBAAkB;QACtC,uBAAuB,EAAE,2BAA2B;KACrD;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const newComplaintEvent: import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
3
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
4
|
+
}>, {
|
|
5
|
+
domain: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
6
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
7
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
8
|
+
}>>;
|
|
9
|
+
}> | import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.POLLING, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
10
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
11
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
12
|
+
}>, {
|
|
13
|
+
domain: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
14
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
15
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
16
|
+
}>>;
|
|
17
|
+
}> | import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
18
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
19
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
20
|
+
}>, {
|
|
21
|
+
domain: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
22
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
23
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
24
|
+
}>>;
|
|
25
|
+
}> | import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
26
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
27
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
28
|
+
}>, {
|
|
29
|
+
domain: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
30
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
31
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
32
|
+
}>>;
|
|
33
|
+
}>;
|
|
34
|
+
//# sourceMappingURL=new-complaint-event.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-complaint-event.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/new-complaint-event.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmB5B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.newComplaintEvent = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
exports.newComplaintEvent = (0, common_1.createMailgunWebhookTrigger)({
|
|
6
|
+
name: 'new_complaint_event',
|
|
7
|
+
displayName: 'New Complaint Event',
|
|
8
|
+
description: 'Triggers when a recipient reports an email as spam in Mailgun',
|
|
9
|
+
eventType: 'complained',
|
|
10
|
+
testEventFilter: { event: 'complained' },
|
|
11
|
+
sampleData: {
|
|
12
|
+
event: 'complained',
|
|
13
|
+
id: 'abc456',
|
|
14
|
+
timestamp: 1710000000,
|
|
15
|
+
recipient: 'user@example.com',
|
|
16
|
+
domain: 'example.com',
|
|
17
|
+
log_level: 'warn',
|
|
18
|
+
message_headers_message_id: '20240310120000.abc456@example.com',
|
|
19
|
+
message_headers_from: 'sender@example.com',
|
|
20
|
+
message_headers_to: 'user@example.com',
|
|
21
|
+
message_headers_subject: 'Newsletter March 2024',
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=new-complaint-event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-complaint-event.js","sourceRoot":"","sources":["../../../../src/lib/triggers/new-complaint-event.ts"],"names":[],"mappings":";;;AAAA,qCAAuD;AAE1C,QAAA,iBAAiB,GAAG,IAAA,oCAA2B,EAAC;IAC3D,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EAAE,qBAAqB;IAClC,WAAW,EACT,+DAA+D;IACjE,SAAS,EAAE,YAAY;IACvB,eAAe,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE;IACxC,UAAU,EAAE;QACV,KAAK,EAAE,YAAY;QACnB,EAAE,EAAE,QAAQ;QACZ,SAAS,EAAE,UAAU;QACrB,SAAS,EAAE,kBAAkB;QAC7B,MAAM,EAAE,aAAa;QACrB,SAAS,EAAE,MAAM;QACjB,0BAA0B,EAAE,mCAAmC;QAC/D,oBAAoB,EAAE,oBAAoB;QAC1C,kBAAkB,EAAE,kBAAkB;QACtC,uBAAuB,EAAE,uBAAuB;KACjD;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const newDeliveryEvent: import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
3
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
4
|
+
}>, {
|
|
5
|
+
domain: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
6
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
7
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
8
|
+
}>>;
|
|
9
|
+
}> | import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.POLLING, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
10
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
11
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
12
|
+
}>, {
|
|
13
|
+
domain: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
14
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
15
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
16
|
+
}>>;
|
|
17
|
+
}> | import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
18
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
19
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
20
|
+
}>, {
|
|
21
|
+
domain: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
22
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
23
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
24
|
+
}>>;
|
|
25
|
+
}> | import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
26
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
27
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
28
|
+
}>, {
|
|
29
|
+
domain: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
30
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
31
|
+
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
32
|
+
}>>;
|
|
33
|
+
}>;
|
|
34
|
+
//# sourceMappingURL=new-delivery-event.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-delivery-event.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/new-delivery-event.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqB3B,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.newDeliveryEvent = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
exports.newDeliveryEvent = (0, common_1.createMailgunWebhookTrigger)({
|
|
6
|
+
name: 'new_delivery_event',
|
|
7
|
+
displayName: 'New Delivery Event',
|
|
8
|
+
description: 'Triggers when an email is successfully delivered in Mailgun',
|
|
9
|
+
eventType: 'delivered',
|
|
10
|
+
testEventFilter: { event: 'delivered' },
|
|
11
|
+
sampleData: {
|
|
12
|
+
event: 'delivered',
|
|
13
|
+
id: 'abc789',
|
|
14
|
+
timestamp: 1710000000,
|
|
15
|
+
recipient: 'user@example.com',
|
|
16
|
+
domain: 'example.com',
|
|
17
|
+
log_level: 'info',
|
|
18
|
+
message_headers_message_id: '20240310120000.abc789@example.com',
|
|
19
|
+
message_headers_from: 'sender@example.com',
|
|
20
|
+
message_headers_to: 'user@example.com',
|
|
21
|
+
message_headers_subject: 'Welcome to our service',
|
|
22
|
+
delivery_status_code: 250,
|
|
23
|
+
delivery_status_message: 'OK',
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=new-delivery-event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-delivery-event.js","sourceRoot":"","sources":["../../../../src/lib/triggers/new-delivery-event.ts"],"names":[],"mappings":";;;AAAA,qCAAuD;AAE1C,QAAA,gBAAgB,GAAG,IAAA,oCAA2B,EAAC;IAC1D,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,oBAAoB;IACjC,WAAW,EACT,6DAA6D;IAC/D,SAAS,EAAE,WAAW;IACtB,eAAe,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE;IACvC,UAAU,EAAE;QACV,KAAK,EAAE,WAAW;QAClB,EAAE,EAAE,QAAQ;QACZ,SAAS,EAAE,UAAU;QACrB,SAAS,EAAE,kBAAkB;QAC7B,MAAM,EAAE,aAAa;QACrB,SAAS,EAAE,MAAM;QACjB,0BAA0B,EAAE,mCAAmC;QAC/D,oBAAoB,EAAE,oBAAoB;QAC1C,kBAAkB,EAAE,kBAAkB;QACtC,uBAAuB,EAAE,wBAAwB;QACjD,oBAAoB,EAAE,GAAG;QACzB,uBAAuB,EAAE,IAAI;KAC9B;CACF,CAAC,CAAC"}
|