Skip to content

Commit 13c885a

Browse files
luancazarinecoderabbitai[bot]michelle0927
authored
13286 components aevent (#19030)
* Implement AEvent component with registrant listing and new registrant source - Added methods for API interaction including listing registrants and pagination. - Introduced a new source for emitting events when a new registrant is added. - Updated package version to 0.1.0 and added dependency on @pipedream/platform. * pnpm update * Update components/aevent/sources/new-registrant/new-registrant.mjs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Refactor new-registrant.mjs to remove redundant check for responseArray length * Update components/aevent/sources/new-registrant/new-registrant.mjs --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: michelle0927 <michelle0927@users.noreply.github.com>
1 parent fbb6301 commit 13c885a

File tree

5 files changed

+213
-6
lines changed

5 files changed

+213
-6
lines changed

components/aevent/aevent.app.mjs

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,58 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "aevent",
4-
propDefinitions: {},
56
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
7+
_apiUrl() {
8+
return "https://app.aevent.com/api";
9+
},
10+
_getHeaders() {
11+
return {
12+
"Authorization": `Bearer ${this.$auth.api_token}`,
13+
"Accept": "application/json",
14+
"Content-Type": "application/json",
15+
};
16+
},
17+
_makeRequest({
18+
$ = this, path, ...opts
19+
}) {
20+
return axios($, {
21+
url: `${this._apiUrl()}/${path}`,
22+
headers: this._getHeaders(),
23+
...opts,
24+
});
25+
},
26+
listRegistrants(args = {}) {
27+
return this._makeRequest({
28+
path: "registrants",
29+
...args,
30+
});
31+
},
32+
async *paginate({
33+
fn, params = {}, maxResults = null,
34+
}) {
35+
let hasMore = false;
36+
let count = 0;
37+
let page = 0;
38+
39+
do {
40+
params.page = page++;
41+
const { success: data } = await fn({
42+
params,
43+
});
44+
45+
for (const d of data) {
46+
yield d;
47+
48+
if (maxResults && ++count === maxResults) {
49+
return count;
50+
}
51+
}
52+
53+
hasMore = data.length;
54+
55+
} while (hasMore);
956
},
1057
},
1158
};

components/aevent/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/aevent",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream AEvent Components",
55
"main": "aevent.app.mjs",
66
"keywords": [
@@ -11,5 +11,8 @@
1111
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.1.1"
1417
}
1518
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";
2+
import aevent from "../../aevent.app.mjs";
3+
import sampleEmit from "./test-event.mjs";
4+
5+
export default {
6+
key: "aevent-new-registrant",
7+
name: "New Registrant",
8+
description: "Emit new event when a new registrant is added. [See the Documentation](https://app.aevent.com/#/settings)",
9+
version: "0.0.1",
10+
type: "source",
11+
dedupe: "unique",
12+
props: {
13+
aevent,
14+
db: "$.service.db",
15+
timer: {
16+
type: "$.interface.timer",
17+
default: {
18+
intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
19+
},
20+
},
21+
},
22+
methods: {
23+
_getLastDate() {
24+
return this.db.get("lastDate") || 0;
25+
},
26+
_setLastDate(lastDate) {
27+
this.db.set("lastDate", lastDate);
28+
},
29+
async emitEvent(maxResults = false) {
30+
const lastDate = this._getLastDate();
31+
const response = this.aevent.paginate({
32+
fn: this.aevent.listRegistrants,
33+
params: {
34+
lastDate,
35+
},
36+
maxResults,
37+
});
38+
39+
let responseArray = [];
40+
for await (const item of response) {
41+
if (item.registrationTime <= lastDate) break;
42+
responseArray.push(item);
43+
}
44+
45+
if (responseArray.length) {
46+
this._setLastDate(responseArray[0].registrationTime);
47+
}
48+
49+
for (const item of responseArray.reverse()) {
50+
this.$emit(item, {
51+
id: item.uuid,
52+
summary: `New registrant: ${item.email || item.uuid}`,
53+
ts: item.registrationTime,
54+
});
55+
}
56+
},
57+
},
58+
hooks: {
59+
async deploy() {
60+
await this.emitEvent(25);
61+
},
62+
},
63+
async run() {
64+
await this.emitEvent();
65+
},
66+
sampleEmit,
67+
};
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
export default {
2+
"email": "email@example.com",
3+
"firstName": "Test",
4+
"lastName": "Example",
5+
"phone": "+12342342323",
6+
"uuid": "unique-id",
7+
"customFields": {
8+
"Field": ""
9+
},
10+
"integrations": "{\"registration\": {\"agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0\", \"browser\": \"Chrome\", \"operating_system\": \"Windows\"}}",
11+
"webinarID": "webinar-id",
12+
"joinURL": "https://aevent.stream/123abc/123abc",
13+
"webinarTimeline": "timeline-id",
14+
"uniqueID":1,
15+
"unsub":0,
16+
"registrationTime":1762884255,
17+
"timeline": {
18+
"uniqueID":2,
19+
"webinarTimeline": "timeline-id",
20+
"nodeID": "events",
21+
"blocks": "{\"0\": [{\"id\": \"_cxkn4qzpt\", \"day\": \"0\", \"key\": \"0\", \"tag\": null, \"amPm\": 1, \"days\": \"0\", \"hours\": null, \"model\": {\"id\": \"_cxkn4qzpt\", \"message\": \"Welcome to the event everyone, so glad you made it here !\\n\\n\", \"isDelete\": false, \"imagefile\": null, \"action_days\": \"0\", \"fromEventID\": [], \"action_hours\": null, \"fromEventName\": \"\", \"action_groupID\": \"3\", \"action_isAfter\": 1, \"action_isExact\": false, \"action_minutes\": \"5\", \"action_actionTitle\": \"Auto Chat to Audience\"}, \"action\": \"webinar-livechat\", \"dayKey\": \"0\", \"nodeID\": 5, \"groupID\": \"3\", \"isAfter\": 1, \"isExact\": false, \"minutes\": \"5\", \"groupName\": \"Registrants\", \"actionIcon\": \"message-processing\", \"actionTitle\": \"Auto Chat to Audience\", \"insertDayKey\": 0, \"integrationID\": \"adminwebinar\", \"integrationName\": \"LIVE Event Automations\", \"integrationType\": \"WEBINAR\"}, {\"id\": \"_125f969xg\", \"day\": \"0\", \"key\": \"0\", \"tag\": null, \"amPm\": 1, \"days\": \"0\", \"hours\": null, \"model\": {\"id\": \"_125f969xg\", \"message\": \"Welcome to the event everyone, so glad you made it here !\\nHere's the link to join:\\nwww.yourctapage.com\\n\\n\", \"isDelete\": false, \"imagefile\": null, \"action_days\": \"0\", \"fromEventID\": [], \"action_hours\": null, \"action_nodeID\": 5, \"fromEventName\": \"\", \"action_groupID\": \"3\", \"action_isAfter\": 1, \"action_isExact\": false, \"action_minutes\": \"30\", \"action_groupName\": \"Registrants\", \"action_actionTitle\": \"Auto Chat to Audience\"}, \"action\": \"webinar-livechat\", \"dayKey\": \"0\", \"nodeID\": 30, \"groupID\": \"3\", \"isAfter\": 1, \"isExact\": false, \"minutes\": \"30\", \"groupName\": \"Registrants\", \"nodeIdKey\": \"_125f969xg\", \"actionIcon\": \"message-processing\", \"actionTitle\": \"Auto Chat to Audience\", \"insertDayKey\": 0, \"integrationID\": \"adminwebinar\", \"integrationName\": \"LIVE Event Automations\", \"integrationType\": \"WEBINAR\"}], \"+1\": [], \"+2\": [], \"+3\": [], \"+4\": [], \"+5\": [], \"+6\": [], \"+7\": [], \"+8\": [], \"+9\": [], \"-1\": [], \"-2\": [], \"-3\": [], \"-4\": [], \"-5\": [], \"-6\": [], \"-7\": [], \"-8\": [], \"-9\": [], \"+10\": [], \"+11\": [], \"+12\": [], \"+13\": [], \"+14\": [], \"+15\": [], \"+16\": [], \"+17\": [], \"+18\": [], \"+19\": [], \"+20\": [], \"+21\": [], \"+22\": [], \"+23\": [], \"+24\": [], \"+25\": [], \"+26\": [], \"+27\": [], \"+28\": [], \"+29\": [], \"+30\": [], \"+31\": [], \"+32\": [], \"+33\": [], \"+34\": [], \"+35\": [], \"+36\": [], \"+37\": [], \"+38\": [], \"+39\": [], \"+40\": [], \"+41\": [], \"+42\": [], \"+43\": [], \"+44\": [], \"+45\": [], \"-10\": [], \"-11\": [], \"-12\": [], \"-13\": [], \"-14\": [], \"-15\": [], \"-16\": [], \"-17\": [], \"-18\": [], \"-19\": [], \"-20\": [], \"-21\": [], \"-22\": [], \"-23\": [], \"-24\": [], \"-25\": [], \"-26\": [], \"-27\": [], \"-28\": [], \"-29\": [], \"-30\": [], \"-31\": [], \"-32\": [], \"-33\": [], \"-34\": [], \"-35\": [], \"-36\": [], \"-37\": [], \"-38\": [], \"-39\": [], \"-40\": [], \"-41\": [], \"-42\": [], \"-43\": [], \"-44\": [], \"-45\": []}",
22+
"created_at": "2025-05-13T22:47:28.000000Z",
23+
"updated_at": "2025-11-11T17:57:18.000000Z",
24+
"version": null,
25+
"deleted_at": null,
26+
"level": null,
27+
"registration_setting": {
28+
"uniqueID":5,
29+
"generalSettingID": "general-setting-id",
30+
"nodeID": "registration",
31+
"blocks": "{\"type\": \"multi-option\", \"block\": 0, \"joinStart\": \"15\", \"setupType\": \"page\", \"whitelist\": {\"domains\": \"\", \"enabled\": false}, \"buttonType\": \"defaultButton\", \"customForms\": [{\"name\": \"Field\", \"type\": \"custom_form\"}], \"replayStart\": \"45\", \"customeEnable\": false, \"registrationBody\": \"Test\", \"registrationStart\": \"15\", \"isInnerPageEnabled\": true, \"registrationSubject\": \"Test\"}",
32+
"created_at": "2025-05-13T22:47:27.000000Z",
33+
"updated_at": "2025-11-11T18:03:02.000000Z",
34+
"version": null,
35+
"deleted_at": null,
36+
"timelineID": "timeline-id",
37+
"type": "multi-option",
38+
"block":0,
39+
"joinStart": "15",
40+
"setupType": "page",
41+
"whitelist": {
42+
"domains": "",
43+
"enabled":false
44+
},
45+
"buttonType": "defaultButton",
46+
"customForms":[
47+
{
48+
"name": "Field",
49+
"type": "custom_form"
50+
}
51+
],
52+
"replayStart": "45",
53+
"customeEnable":false,
54+
"registrationBody": "registration-body",
55+
"registrationStart": "15",
56+
"isInnerPageEnabled":true,
57+
"registrationSubject": "registration-subject",
58+
"timeline": {
59+
"uniqueID":2,
60+
"webinarTimeline": "unique-timeline-id",
61+
"nodeID": "events",
62+
"blocks": "{\"0\": [{\"id\": \"_cxkn4qzpt\", \"day\": \"0\", \"key\": \"0\", \"tag\": null, \"amPm\": 1, \"days\": \"0\", \"hours\": null, \"model\": {\"id\": \"_cxkn4qzpt\", \"message\": \"Welcome to the event everyone, so glad you made it here !\\n\\n\", \"isDelete\": false, \"imagefile\": null, \"action_days\": \"0\", \"fromEventID\": [], \"action_hours\": null, \"fromEventName\": \"\", \"action_groupID\": \"3\", \"action_isAfter\": 1, \"action_isExact\": false, \"action_minutes\": \"5\", \"action_actionTitle\": \"Auto Chat to Audience\"}, \"action\": \"webinar-livechat\", \"dayKey\": \"0\", \"nodeID\": 5, \"groupID\": \"3\", \"isAfter\": 1, \"isExact\": false, \"minutes\": \"5\", \"groupName\": \"Registrants\", \"actionIcon\": \"message-processing\", \"actionTitle\": \"Auto Chat to Audience\", \"insertDayKey\": 0, \"integrationID\": \"adminwebinar\", \"integrationName\": \"LIVE Event Automations\", \"integrationType\": \"WEBINAR\"}, {\"id\": \"_125f969xg\", \"day\": \"0\", \"key\": \"0\", \"tag\": null, \"amPm\": 1, \"days\": \"0\", \"hours\": null, \"model\": {\"id\": \"_125f969xg\", \"message\": \"Welcome to the event everyone, so glad you made it here !\\nHere's the link to join:\\nwww.yourctapage.com\\n\\n\", \"isDelete\": false, \"imagefile\": null, \"action_days\": \"0\", \"fromEventID\": [], \"action_hours\": null, \"action_nodeID\": 5, \"fromEventName\": \"\", \"action_groupID\": \"3\", \"action_isAfter\": 1, \"action_isExact\": false, \"action_minutes\": \"30\", \"action_groupName\": \"Registrants\", \"action_actionTitle\": \"Auto Chat to Audience\"}, \"action\": \"webinar-livechat\", \"dayKey\": \"0\", \"nodeID\": 30, \"groupID\": \"3\", \"isAfter\": 1, \"isExact\": false, \"minutes\": \"30\", \"groupName\": \"Registrants\", \"nodeIdKey\": \"_125f969xg\", \"actionIcon\": \"message-processing\", \"actionTitle\": \"Auto Chat to Audience\", \"insertDayKey\": 0, \"integrationID\": \"adminwebinar\", \"integrationName\": \"LIVE Event Automations\", \"integrationType\": \"WEBINAR\"}], \"+1\": [], \"+2\": [], \"+3\": [], \"+4\": [], \"+5\": [], \"+6\": [], \"+7\": [], \"+8\": [], \"+9\": [], \"-1\": [], \"-2\": [], \"-3\": [], \"-4\": [], \"-5\": [], \"-6\": [], \"-7\": [], \"-8\": [], \"-9\": [], \"+10\": [], \"+11\": [], \"+12\": [], \"+13\": [], \"+14\": [], \"+15\": [], \"+16\": [], \"+17\": [], \"+18\": [], \"+19\": [], \"+20\": [], \"+21\": [], \"+22\": [], \"+23\": [], \"+24\": [], \"+25\": [], \"+26\": [], \"+27\": [], \"+28\": [], \"+29\": [], \"+30\": [], \"+31\": [], \"+32\": [], \"+33\": [], \"+34\": [], \"+35\": [], \"+36\": [], \"+37\": [], \"+38\": [], \"+39\": [], \"+40\": [], \"+41\": [], \"+42\": [], \"+43\": [], \"+44\": [], \"+45\": [], \"-10\": [], \"-11\": [], \"-12\": [], \"-13\": [], \"-14\": [], \"-15\": [], \"-16\": [], \"-17\": [], \"-18\": [], \"-19\": [], \"-20\": [], \"-21\": [], \"-22\": [], \"-23\": [], \"-24\": [], \"-25\": [], \"-26\": [], \"-27\": [], \"-28\": [], \"-29\": [], \"-30\": [], \"-31\": [], \"-32\": [], \"-33\": [], \"-34\": [], \"-35\": [], \"-36\": [], \"-37\": [], \"-38\": [], \"-39\": [], \"-40\": [], \"-41\": [], \"-42\": [], \"-43\": [], \"-44\": [], \"-45\": []}",
63+
"created_at": "2025-05-13T22:47:28.000000Z",
64+
"updated_at": "2025-11-11T17:57:18.000000Z",
65+
"version": null,
66+
"deleted_at": null,
67+
"level": null
68+
}
69+
}
70+
},
71+
"attendance": {
72+
"groups":[
73+
"Registrants",
74+
"Non-Attendee"
75+
]
76+
},
77+
"added":[
78+
"AEvent.Stream"
79+
],
80+
"pending":[],
81+
"timelineName": "timeline-name",
82+
"failed":false,
83+
"banned":false,
84+
"webinarSubject": "webinar-subject",
85+
"registrationDate": "11/11/2025 - 1:04 PM EST"
86+
}

pnpm-lock.yaml

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)