first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled

This commit is contained in:
2026-03-17 16:22:57 +03:30
commit 3d5eaf9445
15349 changed files with 2847338 additions and 0 deletions
@@ -0,0 +1,25 @@
{
"node": "n8n-nodes-base.eventbriteTrigger",
"nodeVersion": "1.0",
"codexVersion": "1.0",
"categories": ["Sales"],
"resources": {
"credentialDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/credentials/eventbrite/"
}
],
"primaryDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.eventbritetrigger/"
}
],
"generic": [
{
"label": "Hey founders! Your business doesn't need you to operate",
"icon": " 🖥️",
"url": "https://n8n.io/blog/your-business-doesnt-need-you-to-operate/"
}
]
}
}
@@ -0,0 +1,343 @@
import type {
IHookFunctions,
IWebhookFunctions,
IDataObject,
ILoadOptionsFunctions,
INodePropertyOptions,
INodeType,
INodeTypeDescription,
IWebhookResponseData,
JsonObject,
} from 'n8n-workflow';
import { NodeApiError, NodeConnectionTypes } from 'n8n-workflow';
import {
eventbriteApiRequest,
eventbriteApiRequestAllItems,
isValidEventbriteUrl,
} from './GenericFunctions';
export class EventbriteTrigger implements INodeType {
description: INodeTypeDescription = {
displayName: 'Eventbrite Trigger',
name: 'eventbriteTrigger',
// eslint-disable-next-line n8n-nodes-base/node-class-description-icon-not-svg
icon: 'file:eventbrite.png',
group: ['trigger'],
version: 1,
description: 'Handle Eventbrite events via webhooks',
subtitle: '={{$parameter["event"]}}',
defaults: {
name: 'Eventbrite Trigger',
},
inputs: [],
outputs: [NodeConnectionTypes.Main],
credentials: [
{
name: 'eventbriteApi',
required: true,
displayOptions: {
show: {
authentication: ['privateKey'],
},
},
},
{
name: 'eventbriteOAuth2Api',
required: true,
displayOptions: {
show: {
authentication: ['oAuth2'],
},
},
},
],
webhooks: [
{
name: 'default',
httpMethod: 'POST',
responseMode: 'onReceived',
path: 'webhook',
},
],
properties: [
{
displayName: 'Authentication',
name: 'authentication',
type: 'options',
options: [
{
name: 'Private Key',
value: 'privateKey',
},
{
name: 'OAuth2',
value: 'oAuth2',
},
],
default: 'privateKey',
},
{
displayName: 'Organization Name or ID',
name: 'organization',
type: 'options',
required: true,
typeOptions: {
loadOptionsMethod: 'getOrganizations',
},
default: '',
description:
'The Eventbrite Organization to work on. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Event Name or ID',
name: 'event',
type: 'options',
required: true,
typeOptions: {
loadOptionsDependsOn: ['organization'],
loadOptionsMethod: 'getEvents',
},
default: '',
description:
'Limit the triggers to this event. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Actions',
name: 'actions',
type: 'multiOptions',
options: [
{
name: 'attendee.checked_in',
value: 'attendee.checked_in',
},
{
name: 'attendee.checked_out',
value: 'attendee.checked_out',
},
{
name: 'attendee.updated',
value: 'attendee.updated',
},
{
name: 'event.created',
value: 'event.created',
},
{
name: 'event.published',
value: 'event.published',
},
{
name: 'event.unpublished',
value: 'event.unpublished',
},
{
name: 'event.updated',
value: 'event.updated',
},
{
name: 'order.placed',
value: 'order.placed',
},
{
name: 'order.refunded',
value: 'order.refunded',
},
{
name: 'order.updated',
value: 'order.updated',
},
{
name: 'organizer.updated',
value: 'organizer.updated',
},
{
name: 'ticket_class.created',
value: 'ticket_class.created',
},
{
name: 'ticket_class.deleted',
value: 'ticket_class.deleted',
},
{
name: 'ticket_class.updated',
value: 'ticket_class.updated',
},
{
name: 'venue.updated',
value: 'venue.updated',
},
],
required: true,
default: [],
description: 'One or more action to subscribe to',
},
{
displayName: 'Resolve Data',
name: 'resolveData',
type: 'boolean',
default: true,
// eslint-disable-next-line n8n-nodes-base/node-param-description-boolean-without-whether
description:
'By default does the webhook-data only contain the URL to receive the object data manually. If this option gets activated, it will resolve the data automatically.',
},
],
};
methods = {
loadOptions: {
// Get all the available organizations to display them to user so that they can
// select them easily
async getOrganizations(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const returnData: INodePropertyOptions[] = [];
const organizations = await eventbriteApiRequestAllItems.call(
this,
'organizations',
'GET',
'/users/me/organizations',
);
for (const organization of organizations) {
const organizationName = organization.name;
const organizationId = organization.id;
returnData.push({
name: organizationName,
value: organizationId,
});
}
return returnData;
},
// Get all the available events to display them to user so that they can
// select them easily
async getEvents(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const returnData: INodePropertyOptions[] = [{ name: 'All', value: 'all' }];
const organization = this.getCurrentNodeParameter('organization');
const events = await eventbriteApiRequestAllItems.call(
this,
'events',
'GET',
`/organizations/${organization}/events`,
);
for (const event of events) {
const eventName = event.name.text;
const eventId = event.id;
returnData.push({
name: eventName,
value: eventId,
});
}
return returnData;
},
},
};
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
const webhookData = this.getWorkflowStaticData('node');
const webhookUrl = this.getNodeWebhookUrl('default');
const organisation = this.getNodeParameter('organization') as string;
const actions = this.getNodeParameter('actions') as string[];
const endpoint = `/organizations/${organisation}/webhooks/`;
const { webhooks } = await eventbriteApiRequest.call(this, 'GET', endpoint);
const check = (currentActions: string[], webhookActions: string[]) => {
for (const currentAction of currentActions) {
if (!webhookActions.includes(currentAction)) {
return false;
}
}
return true;
};
for (const webhook of webhooks) {
if (webhook.endpoint_url === webhookUrl && check(actions, webhook.actions as string[])) {
webhookData.webhookId = webhook.id;
return true;
}
}
return false;
},
async create(this: IHookFunctions): Promise<boolean> {
const webhookUrl = this.getNodeWebhookUrl('default');
const webhookData = this.getWorkflowStaticData('node');
const organisation = this.getNodeParameter('organization') as string;
const event = this.getNodeParameter('event') as string;
const actions = this.getNodeParameter('actions') as string[];
const endpoint = `/organizations/${organisation}/webhooks/`;
const body: IDataObject = {
endpoint_url: webhookUrl,
actions: actions.join(','),
event_id: event,
};
if (event === 'all' || event === '') {
delete body.event_id;
}
const responseData = await eventbriteApiRequest.call(this, 'POST', endpoint, body);
webhookData.webhookId = responseData.id;
return true;
},
async delete(this: IHookFunctions): Promise<boolean> {
let responseData;
const webhookData = this.getWorkflowStaticData('node');
const endpoint = `/webhooks/${webhookData.webhookId}/`;
try {
responseData = await eventbriteApiRequest.call(this, 'DELETE', endpoint);
} catch (error) {
return false;
}
if (!responseData.success) {
return false;
}
delete webhookData.webhookId;
return true;
},
},
};
async webhook(this: IWebhookFunctions): Promise<IWebhookResponseData> {
const req = this.getRequestObject();
const apiUrl = (req.body as IDataObject).api_url;
if (!isValidEventbriteUrl(apiUrl)) {
throw new NodeApiError(this.getNode(), req.body as JsonObject, {
message: 'The received data does not contain a valid Eventbrite API URL!',
});
}
const resolveData = this.getNodeParameter('resolveData', false) as boolean;
if (!resolveData) {
// Return the data as it got received
return {
workflowData: [this.helpers.returnJsonArray(req.body as IDataObject)],
};
}
if (req.body.api_url.includes('api-endpoint-to-fetch-object-details')) {
return {
workflowData: [
this.helpers.returnJsonArray({
placeholder:
'Test received. To display actual data of object get the webhook triggered by performing the action which triggers it.',
}),
],
};
}
const responseData = await eventbriteApiRequest.call(
this,
'GET',
'',
{},
undefined,
req.body.api_url as string,
);
return {
workflowData: [this.helpers.returnJsonArray(responseData as IDataObject)],
};
}
}
@@ -0,0 +1,85 @@
import type {
IDataObject,
IExecuteFunctions,
IHookFunctions,
IHttpRequestMethods,
ILoadOptionsFunctions,
IRequestOptions,
IWebhookFunctions,
JsonObject,
} from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow';
const baseUrl = 'https://www.eventbriteapi.com/';
export function isValidEventbriteUrl(url: unknown): boolean {
return typeof url === 'string' && url.startsWith(baseUrl);
}
export async function eventbriteApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
method: IHttpRequestMethods,
resource: string,
body: any = {},
qs: IDataObject = {},
uri?: string,
option: IDataObject = {},
): Promise<any> {
let options: IRequestOptions = {
headers: {},
method,
qs,
body,
uri: uri || `${baseUrl}v3${resource}`,
json: true,
};
options = Object.assign({}, options, option);
if (Object.keys(options.body as IDataObject).length === 0) {
delete options.body;
}
const authenticationMethod = this.getNodeParameter('authentication', 0);
try {
if (authenticationMethod === 'privateKey') {
const credentials = await this.getCredentials('eventbriteApi');
options.headers!.Authorization = `Bearer ${credentials.apiKey}`;
return await this.helpers.request(options);
} else {
return await this.helpers.requestOAuth2.call(this, 'eventbriteOAuth2Api', options);
}
} catch (error) {
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
/**
* Make an API request to paginated flow endpoint
* and return all results
*/
export async function eventbriteApiRequestAllItems(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
propertyName: string,
method: IHttpRequestMethods,
resource: string,
body: any = {},
query: IDataObject = {},
): Promise<any> {
const returnData: IDataObject[] = [];
let responseData;
do {
responseData = await eventbriteApiRequest.call(this, method, resource, body, query);
query.continuation = responseData.pagination.continuation;
returnData.push.apply(returnData, responseData[propertyName] as IDataObject[]);
} while (
responseData.pagination?.has_more_items !== undefined &&
responseData.pagination.has_more_items !== false
);
return returnData;
}
@@ -0,0 +1,114 @@
import type { Request } from 'express';
import { mock, mockDeep } from 'jest-mock-extended';
import { returnJsonArray } from 'n8n-core';
import type { INode, IWebhookFunctions } from 'n8n-workflow';
import * as GenericFunctions from '../GenericFunctions';
import { EventbriteTrigger } from '../EventbriteTrigger.node';
describe('EventbriteTrigger node', () => {
describe('webhook', () => {
const mockWebhookFunctions = mockDeep<IWebhookFunctions>();
beforeEach(() => {
jest.resetAllMocks();
mockWebhookFunctions.getNode.mockReturnValue(mock<INode>());
mockWebhookFunctions.helpers.returnJsonArray.mockImplementation(returnJsonArray);
});
it('should throw an error when the `api_url` is not provided', async () => {
mockWebhookFunctions.getRequestObject.mockReturnValue({
body: {
api_url: undefined,
},
} as Request);
const eventbriteTrigger = new EventbriteTrigger();
await expect(eventbriteTrigger.webhook.call(mockWebhookFunctions)).rejects.toThrow(
'The received data does not contain a valid Eventbrite API URL!',
);
});
it('should throw an error when the `api_url` is not a valid Eventbrite API URL', async () => {
mockWebhookFunctions.getRequestObject.mockReturnValue({
body: {
api_url: 'https://www.google.com',
},
} as Request);
const eventbriteTrigger = new EventbriteTrigger();
await expect(eventbriteTrigger.webhook.call(mockWebhookFunctions)).rejects.toThrow(
'The received data does not contain a valid Eventbrite API URL!',
);
});
it('should return data as is when the `resolveData` is false', async () => {
mockWebhookFunctions.getRequestObject.mockReturnValue({
body: {
api_url: 'https://www.eventbriteapi.com/v3/events/1234567890',
data: {
foo: 'bar',
},
},
} as Request);
mockWebhookFunctions.getNodeParameter.mockImplementation((parameterName: string) => {
switch (parameterName) {
case 'resolveData':
return false;
default:
return undefined;
}
});
const eventbriteTrigger = new EventbriteTrigger();
const result = await eventbriteTrigger.webhook.call(mockWebhookFunctions);
expect(result.workflowData).toEqual([
[
{
json: {
api_url: 'https://www.eventbriteapi.com/v3/events/1234567890',
data: {
foo: 'bar',
},
},
},
],
]);
});
it('should call the `api_url` and return the response when the `resolveData` is true', async () => {
mockWebhookFunctions.getRequestObject.mockReturnValue({
body: {
api_url: 'https://www.eventbriteapi.com/v3/events/1234567890',
data: {
foo: 'bar',
},
},
} as Request);
mockWebhookFunctions.getNodeParameter.mockImplementation((parameterName: string) => {
switch (parameterName) {
case 'resolveData':
return true;
default:
return undefined;
}
});
const spy = jest.spyOn(GenericFunctions, 'eventbriteApiRequest');
spy.mockResolvedValue({
test: 123,
});
const eventbriteTrigger = new EventbriteTrigger();
const result = await eventbriteTrigger.webhook.call(mockWebhookFunctions);
expect(result.workflowData).toEqual([
[
{
json: {
test: 123,
},
},
],
]);
});
});
});
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB