Eventbrite has an official sdk for their API. According to docs, installing and using should be easy:
const eventbrite = require('eventbrite');
// Create configured Eventbrite SDK
const sdk = eventbrite({token: 'OATH_TOKEN_HERE'});
sdk.request('/users/me').then(res => {
// handle response data
});
However this does not work, I get an error "eventbrite is not a function" when trying to crate the sdk object. In fact, if I log what's in require('eventbrite') this is all I get:
const eventbrite = require('eventbrite');
console.log(JSON.stringify(eventbrite));
// {
// "PAGE_KEY": "page",
// "CONTINUATION_KEY": "continuation"
// }
I have probably got something really wrong here, is there an extra step I need to take after installing via npm?
I figured it out, for this to work you gotta do:
const eventbrite = require('eventbrite').default;
I figure this has something to do with the way Node is managing requires in later versions (10, in my case).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With