Get paginated response and loop for each iteration on eventbrite api call

Hello everyone,

I’m currently working on setting up a workflow in n8n to automate the retrieval of attendees from Eventbrite events and store them in Airtable. Here’s how I’d like the workflow to operate:

  • Every day at midnight, I’d like to fetch the events of the day using the Eventbrite API.
  • Then, for each event, I’d like to fetch the list of registered attendees.
  • The Eventbrite API returns a paginated list of attendees, with a has_more_items field indicating if there are more attendees to fetch.
  • When has_more_items is true for an event, I’d like to store the first list of attendees in an array, then retrieve the subsequent lists until there are no more.
  • Finally, I’d like to shuffle all the retrieved attendee lists to get a consolidated list, which I can then save to Airtable.

Can you help me set up this workflow in n8n?

  • n8n version : Version 1.6.1 ;
  • database : default ;
  • n8n EXECUTIONS_PROCESS: default
  • Running n8n via n8n cloud
  • Operating system : macOS 14.2.1 (23C71)

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:
1 Like
  • n8n version : Version 1.6.1 ;
  • database : default ;
  • n8n EXECUTIONS_PROCESS: default
  • Running n8n via n8n cloud
  • Operating system : macOS 14.2.1 (23C71)

URGENT You shared your eventbrite API KEY!
Go generate a new one ASAP and delete that old key, that’s the same as a password to your account

While it’s ok to send auth like that, using n8ns built in auth tools will help prevent security mistakes like that. Go and create a custom header auth like this and put the api key in

Then in your http request add that auth like this
Screenshot 2024-02-11 at 10.58.57 AM

To answer your original question

It sounds like everything you need is built into the HTTP node. You can handle pagination right in the node.

Set it up like this:

You can see in there I set Pagination Complete When to other.
Then the Complete Expression should be {{ !$response.body.has_more_items }}
(if has_more_items is nested in json in the body you’ll need to modift that expression of course)

You need the ! to say you want the opposite, as the HTTP node will stop the pagination once the Complete Expression field evaluates to true. And we want to stop getting new responses at has_more_items being false, so it needs to be flipped.

Then to combine it into one item, just connect the HTTP node into an Aggregate node and set Include to All Fields, like this:

Let me know if you have any questions

2 Likes

In my n8n version, I don’t have Aggregrate node, and not this kind of http request node,

Still stuck on

I would recommend upgrading your n8n Version. Using the built-in feature, like this, wouldn’t make it simpler. I can send a version that uses the loop over items node instead Don’t want to update.

The aggregate node is still there. It’s just called something different in older versions. Off the top of my head, I believe it is in the list tools node and is in the drop-down of that note called Concatenate

Can you send me the version with the loop over items node please
I’ll try to use Concatenate

I actually just noticed you’re on version 1.6.1, HTTP definitely has that functionality in that version.

You need to click on Add option then Pagination to get those options. You can also just copy and paste the code from that node I shared in my reply (press the orange text that says “this workflow’s code”

Please try that first. If it doesn’t work for you then i’ll make that custom loop

This is the refactor on my workflow

I can’t understand why when the response to the request is paginated, the next action (merge attendees and event before saving on airtable) doesn’t execute, and I end up in an infinite loop, do you have a trick to fix?
Thanks
@liam @n8n

Can you send a sample of what the json response from the http request is?

If it’s getting stuck on the http my first assumption would be that has_more_items isn’t being accessed correctly within the pagination section, so then the pagination would just keep going.

Please send a sample of the json response

A sample json response

@liam

[
  {
    "pagination": {
      "object_count": 300,
      "page_number": 1,
      "page_size": 50,
      "page_count": 6,
      "continuation": "eyJwYWdlIjogMn0",
      "has_more_items": true
    },
    "attendees": [
      {
        "costs": { 
        },
        "resource_uri": "https://www.eventbriteapi.com/v3/events/event_id/attendees/attendes_id/",
        "id": "14328180099",
        "changed": "2024-01-09T16:21:46Z",
        "created": "2024-01-09T16:21:42Z",
        "quantity": 1,
        "variant_id": null,
        "profile": {
          "first_name": "John",
          "last_name": "Doe",
          "email": "[email protected]",
          "name": "John Doe",
          "addresses": {}
        },
        "barcodes": [{}],
        "answers": [
          {
            "answer": "+243 817 706 154",
            "question": "Numéro de téléphone",
            "type": "text",
            "question_id": "189675069"
          }
        ],
        "checked_in": false,
        "cancelled": false,
        "refunded": false,
        "affiliate": "ebemoffollowpublishemail",
        "guestlist_id": null,
        "invited_by": null,
        "status": "Attending",
        "ticket_class_name": "Admission générale",
        "delivery_method": "electronic",
        "event_id": "794378727157",
        "order_id": "8662896609",
        "ticket_class_id": "1337573129"
      },
			{
        "costs": { 
        },
        "resource_uri": "https://www.eventbriteapi.com/v3/events/event_id/attendees/attendes_id/",
        "id": "14328180099",
        "changed": "2024-01-09T16:21:46Z",
        "created": "2024-01-09T16:21:42Z",
        "quantity": 1,
        "variant_id": null,
        "profile": {
          "first_name": "John",
          "last_name": "Doe",
          "email": "[email protected]",
          "name": "John Doe",
          "addresses": {}
        },
        "barcodes": [{}],
        "answers": [
          {
            "answer": "+243 817 706 154",
            "question": "Numéro de téléphone",
            "type": "text",
            "question_id": "189675069"
          }
        ],
        "checked_in": false,
        "cancelled": false,
        "refunded": false,
        "affiliate": "ebemoffollowpublishemail",
        "guestlist_id": null,
        "invited_by": null,
        "status": "Attending",
        "ticket_class_name": "Admission générale",
        "delivery_method": "electronic",
        "event_id": "794378727157",
        "order_id": "8662896609",
        "ticket_class_id": "1337573129"
      },
	...
    ]
  }
]

Try setting it up this same way but use {{ !$response. pagination.has_more_items }}

If that doesn’t work try {{ !$response.body.pagination.has_more_items }}

Since has_more_items is under the pagination key, you need to use the dot notation on that first

Let me know how it goes