diff --git a/components/aevent/aevent.app.mjs b/components/aevent/aevent.app.mjs index 1670d2e556081..84c6c18c92390 100644 --- a/components/aevent/aevent.app.mjs +++ b/components/aevent/aevent.app.mjs @@ -1,11 +1,58 @@ +import { axios } from "@pipedream/platform"; + export default { type: "app", app: "aevent", - propDefinitions: {}, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + _apiUrl() { + return "https://app.aevent.com/api"; + }, + _getHeaders() { + return { + "Authorization": `Bearer ${this.$auth.api_token}`, + "Accept": "application/json", + "Content-Type": "application/json", + }; + }, + _makeRequest({ + $ = this, path, ...opts + }) { + return axios($, { + url: `${this._apiUrl()}/${path}`, + headers: this._getHeaders(), + ...opts, + }); + }, + listRegistrants(args = {}) { + return this._makeRequest({ + path: "registrants", + ...args, + }); + }, + async *paginate({ + fn, params = {}, maxResults = null, + }) { + let hasMore = false; + let count = 0; + let page = 0; + + do { + params.page = page++; + const { success: data } = await fn({ + params, + }); + + for (const d of data) { + yield d; + + if (maxResults && ++count === maxResults) { + return count; + } + } + + hasMore = data.length; + + } while (hasMore); }, }, }; diff --git a/components/aevent/package.json b/components/aevent/package.json index 6a15cffb9add5..c38ee463d92af 100644 --- a/components/aevent/package.json +++ b/components/aevent/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/aevent", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream AEvent Components", "main": "aevent.app.mjs", "keywords": [ @@ -11,5 +11,8 @@ "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.1.1" } } diff --git a/components/aevent/sources/new-registrant/new-registrant.mjs b/components/aevent/sources/new-registrant/new-registrant.mjs new file mode 100644 index 0000000000000..8cd18b0a3ccc7 --- /dev/null +++ b/components/aevent/sources/new-registrant/new-registrant.mjs @@ -0,0 +1,67 @@ +import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform"; +import aevent from "../../aevent.app.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + key: "aevent-new-registrant", + name: "New Registrant", + description: "Emit new event when a new registrant is added. [See the Documentation](https://app.aevent.com/#/settings)", + version: "0.0.1", + type: "source", + dedupe: "unique", + props: { + aevent, + db: "$.service.db", + timer: { + type: "$.interface.timer", + default: { + intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, + }, + }, + }, + methods: { + _getLastDate() { + return this.db.get("lastDate") || 0; + }, + _setLastDate(lastDate) { + this.db.set("lastDate", lastDate); + }, + async emitEvent(maxResults = false) { + const lastDate = this._getLastDate(); + const response = this.aevent.paginate({ + fn: this.aevent.listRegistrants, + params: { + lastDate, + }, + maxResults, + }); + + let responseArray = []; + for await (const item of response) { + if (item.registrationTime <= lastDate) break; + responseArray.push(item); + } + + if (responseArray.length) { + this._setLastDate(responseArray[0].registrationTime); + } + + for (const item of responseArray.reverse()) { + this.$emit(item, { + id: item.uuid, + summary: `New registrant: ${item.email || item.uuid}`, + ts: item.registrationTime, + }); + } + }, + }, + hooks: { + async deploy() { + await this.emitEvent(25); + }, + }, + async run() { + await this.emitEvent(); + }, + sampleEmit, +}; diff --git a/components/aevent/sources/new-registrant/test-event.mjs b/components/aevent/sources/new-registrant/test-event.mjs new file mode 100644 index 0000000000000..0cc56442c41ce --- /dev/null +++ b/components/aevent/sources/new-registrant/test-event.mjs @@ -0,0 +1,86 @@ +export default { + "email": "email@example.com", + "firstName": "Test", + "lastName": "Example", + "phone": "+12342342323", + "uuid": "unique-id", + "customFields": { + "Field": "" + }, + "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\"}}", + "webinarID": "webinar-id", + "joinURL": "https://aevent.stream/123abc/123abc", + "webinarTimeline": "timeline-id", + "uniqueID":1, + "unsub":0, + "registrationTime":1762884255, + "timeline": { + "uniqueID":2, + "webinarTimeline": "timeline-id", + "nodeID": "events", + "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\": []}", + "created_at": "2025-05-13T22:47:28.000000Z", + "updated_at": "2025-11-11T17:57:18.000000Z", + "version": null, + "deleted_at": null, + "level": null, + "registration_setting": { + "uniqueID":5, + "generalSettingID": "general-setting-id", + "nodeID": "registration", + "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\"}", + "created_at": "2025-05-13T22:47:27.000000Z", + "updated_at": "2025-11-11T18:03:02.000000Z", + "version": null, + "deleted_at": null, + "timelineID": "timeline-id", + "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": "registration-body", + "registrationStart": "15", + "isInnerPageEnabled":true, + "registrationSubject": "registration-subject", + "timeline": { + "uniqueID":2, + "webinarTimeline": "unique-timeline-id", + "nodeID": "events", + "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\": []}", + "created_at": "2025-05-13T22:47:28.000000Z", + "updated_at": "2025-11-11T17:57:18.000000Z", + "version": null, + "deleted_at": null, + "level": null + } + } + }, + "attendance": { + "groups":[ + "Registrants", + "Non-Attendee" + ] + }, + "added":[ + "AEvent.Stream" + ], + "pending":[], + "timelineName": "timeline-name", + "failed":false, + "banned":false, + "webinarSubject": "webinar-subject", + "registrationDate": "11/11/2025 - 1:04 PM EST" +} \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b8220bc4cb4fd..03ba85d7c7cc4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -444,7 +444,11 @@ importers: specifier: ^3.1.1 version: 3.1.1 - components/aevent: {} + components/aevent: + dependencies: + '@pipedream/platform': + specifier: ^3.1.1 + version: 3.1.1 components/affinda: dependencies: @@ -11431,8 +11435,7 @@ importers: components/postmaster: {} - components/postnitro: - specifiers: {} + components/postnitro: {} components/postnl: dependencies: @@ -12065,8 +12068,7 @@ importers: specifier: ^3.24.0 version: 3.30.0 - components/redash: - specifiers: {} + components/redash: {} components/redcircle_api: dependencies: @@ -14250,11 +14252,9 @@ importers: specifier: ^1.6.8 version: 1.6.8 - components/straico: - specifiers: {} + components/straico: {} - components/straker_verify: - specifiers: {} + components/straker_verify: {} components/strapi: {}