diff --git a/packages/nodes-base/nodes/Eventbrite/EventbriteTrigger.node.ts b/packages/nodes-base/nodes/Eventbrite/EventbriteTrigger.node.ts index 4685c98e61a84..f3a4cc9a7bc8a 100644 --- a/packages/nodes-base/nodes/Eventbrite/EventbriteTrigger.node.ts +++ b/packages/nodes-base/nodes/Eventbrite/EventbriteTrigger.node.ts @@ -26,6 +26,7 @@ export class EventbriteTrigger implements INodeType { group: ['trigger'], version: 1, description: 'Handle Eventbrite events via webhooks', + subtitle: '={{$parameter["event"]}}', defaults: { name: 'Eventbrite Trigger', }, @@ -79,7 +80,6 @@ export class EventbriteTrigger implements INodeType { }, ], default: 'privateKey', - description: 'The resource to operate on.', }, { displayName: 'Organization', @@ -90,7 +90,7 @@ export class EventbriteTrigger implements INodeType { loadOptionsMethod: 'getOrganizations', }, default: '', - description: '', + description: 'The Eventbrite Organization to work on', }, { displayName: 'Event', @@ -104,7 +104,7 @@ export class EventbriteTrigger implements INodeType { loadOptionsMethod: 'getEvents', }, default: '', - description: '', + description: 'Limit the triggers to this event', }, { displayName: 'Actions', @@ -174,14 +174,14 @@ export class EventbriteTrigger implements INodeType { ], required: true, default: [], - description: '', + description: 'One or more action to subscribe to.', }, { displayName: 'Resolve Data', name: 'resolveData', type: 'boolean', default: true, - 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.', + 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', }, ], }; @@ -206,7 +206,7 @@ export class EventbriteTrigger implements INodeType { // Get all the available events to display them to user so that he can // select them easily async getEvents(this: ILoadOptionsFunctions): Promise { - const returnData: 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) { @@ -264,9 +264,10 @@ export class EventbriteTrigger implements INodeType { 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; }, diff --git a/packages/nodes-base/nodes/Eventbrite/GenericFunctions.ts b/packages/nodes-base/nodes/Eventbrite/GenericFunctions.ts index ef1f623b9396d..b2102824afe99 100644 --- a/packages/nodes-base/nodes/Eventbrite/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Eventbrite/GenericFunctions.ts @@ -11,7 +11,7 @@ import { } from 'n8n-core'; import { - IDataObject, NodeApiError, NodeOperationError, + IDataObject, JsonObject, NodeApiError, NodeOperationError, } from 'n8n-workflow'; export async function eventbriteApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions | IWebhookFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise { // tslint:disable-line:no-any @@ -38,13 +38,12 @@ export async function eventbriteApiRequest(this: IHookFunctions | IExecuteFuncti } 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); + throw new NodeApiError(this.getNode(), error as JsonObject); } }