1.4.39 • Published 7 years ago

webuild-events v1.4.39

Weekly downloads
13
License
MIT
Repository
github
Last release
7 years ago

#webuild-events

Get a list of free developer-related events in your city from facebook, meetup.com, eventbrite, ics url and manual entries.

##install

npm i webuild-events

##usage

  1. we will create the following folder structure:

    .
    ├── .env
    ├── config
    │   ├── blacklistEvents.json
    │   ├── facebookGroups.json
    │   ├── icsGroups.json
    │   └── whitelistEvents.json
    ├── config.js
    ├── node_modules
    │   ├── dotenv
    │   └── webuild-events
    └── index.js
  • create a .env file to store all the environment variables:

    	```bash
    	NODE_ENV=development
    	LOCATION=Singapore # name of city
    	WEBUILD_API_SECRET=secret # any random string - used as a password when remotely refreshing the feeds
    	MEETUP_API_KEY=secret # generate it from https://secure.meetup.com/meetup_api/key/ to get meetup.com events
    	EVENTBRITE_TOKEN=secret # generate it from http://developer.eventbrite.com/ to get eventbrite events
    
    	# Create an Auth0 https://auth0.com/ account and a Facebook app and link them (https://docs.auth0.com/facebook-clientid). Configure the `WEBUILD_AUTH0_CLIENT_*` environment variables.`
    	WEBUILD_AUTH0_CLIENT_ID=secret
    	WEBUILD_AUTH0_CLIENT_SECRET=secret
    	```
  • create a json file config/facebookGroups.json to list all the Facebook pages / groups you want to list the upcoming events:

    	```js
    	[
    	  {
    	    "name": "Adobe InDesign Singapore User Group", // name of the facebook page / group
    	    "id": "116531348396769" // id of the facebook page / groups: https://lookup-id.com/
    	  },
    		...
    	]
    	```
  • create 2 json files config/blacklistEvents.json and config/whitelistEvents.json to add / remove events manually:

    	```js
    	[
    	  {
    	    "id": "999999999",
    	    "name": "This is a sample event on how to fill up this file. For whitelistEvents.json: all fields are required. For blacklistEvents.json: id, formatted_time and url are required. Time fields are filled in as an example for time format DD MMM YYYY, ddd, h:mm a.",
    	    "description": "sample description",
    	    "location": "sample location",
    	    "url": "http://www.sample.com/event",
    	    "group_name": "sample group name",
    	    "group_url": "http://www.group.com",
    	    "formatted_time": "14 Nov 2014, Fri, 6:00 pm",
    	    "start_time": "2014-11-14T10:00:00.000Z",
    	    "end_time": "2014-11-16T09:00:00.000Z"
    	  },
    	  ...
    	]
    	```
  • create a json file config/icsGroups.json to list all urls of ics formatted events:

    	```js
    	[
    	  {
    	    "group_name": "KopiJS",
    	    "group_url": "http://kopi.io/",
    	    "ics_url": "https://www.google.com/calendar/ical/dnhunu42fotmefouusg4j8ip0k%40group.calendar.google.com/public/basic.ics"
    	  },
    	  ...
    	]
    	```
  • create a file config.js with the following contents:

    	```js
    	var city = 'Singapore'; // name of your city E.g. 'Sydney'
    	var country = 'Singapore'; // name of your country E.g. 'Australia'
    	var locationSymbol = 'SG'; // country code: https://en.wikipedia.org/wiki/ISO_3166-1#Officially_assigned_code_elements
    
    	function failSafeRequire(filename){
    	  var requiredData;
    	  try {
    	   requiredData  = require(filename);
    	  }
    	  catch(e){
    	    requiredData = [];
    	  }
    	  return requiredData;
    	}
    
    	var facebookGroups = failSafeRequire('./config/facebookGroups.json');
    	var blacklistEvents = failSafeRequire('./config/blacklistEvents.json')
    	var icsGroups = failSafeRequire('./config/icsGroups.json');
    	var whitelistEvents = failSafeRequire('./config/whitelistEvents.json');
    	var duplicateWords = require('./config/duplicateWords.json')[0].words; // see sample in examples/duplicateWords.json
    
    	module.exports = {
    	  location: city,
    	  city: city,
    	  country: country,
    	  symbol: locationSymbol,
    
    	  api_version: 'v1',
    
    	  displayTimeformat: 'DD MMM YYYY, ddd, h:mm a', // format date: http://momentjs.com/docs/#/displaying/
    	  dateFormat: 'YYYY-MM-DD HH:mm Z', // format time: http://momentjs.com/docs/#/displaying/
    	  timezone: '+0800', // timezone UTC offset: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
    	  timezoneInfo: 'Asia/Singapore', // timezone name: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
    
    	  debug: process.env.NODE_ENV === 'development',
    
    	  ignoreWordsInDuplicateEvents: duplicateWords, // array of words to ignore in detecting duplicate events
    
    	  auth0: {
    	    domain: 'webuildsg.auth0.com',
    	    clientId: process.env.WEBUILD_AUTH0_CLIENT_ID,
    	    clientSecret: process.env.WEBUILD_AUTH0_CLIENT_SECRET
    	  },
    
    	  meetupParams: {
    	    key: process.env.MEETUP_API_KEY,
    	    country: locationSymbol,
    	    state: locationSymbol,
    	    city: city,
    	    category_id: 34, // Tech category
    	    page: 500,
    	    fields: 'next_event',
    
    	    blacklistGroups: [],
    	    blacklistWords: [],
    	  },
    
    	  eventbriteParams: {
    	    token: process.env.EVENTBRITE_TOKEN,
    	    url: 'https://www.eventbriteapi.com/v3/events/search',
    	    categories: [
    	      '102',
    	      '119'
    	    ],
    	    blacklistOrganiserId: []
    	  }
    	};
    
    	```
  • create index.js:

    	```js
    	require('dotenv').load();
    	var config = require('./config');
    	var events = require('webuild-events').init(config).events;
    
    	setTimeout(function() {
    	  console.log('Found ' + events.feed.events.length + ' events from Facebook:')
    	  console.log('\nMeta info:')
    	  console.log(events.feed.meta)
    	  console.log('\nFirst event info:')
    	  console.log(events.feed.events[0])
    	}, 30000);
    	```
  • install the relevant dependencies:

    	```bash
    	npm i webuild-event
    	npm i dotenv
    	```
  • run the file with node index.js

#contribute

Please see CONTRIBUTING.md for details.

#versioning

Following the Semantic Versioning guidelines, run the grunt bump, grunt bump:minor or grunt bump:major commands to bump the version accordingly.

#license

webuild-events is released under the MIT License.

1.4.39

7 years ago

1.4.38

8 years ago

1.4.37

8 years ago

1.4.36

9 years ago

1.4.35

9 years ago

1.4.34

9 years ago

1.4.33

9 years ago

1.4.32

9 years ago

1.4.31

9 years ago

1.4.30

9 years ago

1.4.29

9 years ago

1.4.28

9 years ago

1.4.27

9 years ago

1.4.26

9 years ago

1.4.25

9 years ago

1.4.24

9 years ago

1.4.23

9 years ago

1.4.22

9 years ago

1.4.21

9 years ago

1.4.20

9 years ago

1.4.19

9 years ago

1.4.18

9 years ago

1.4.17

9 years ago

1.4.16

9 years ago

1.4.15

9 years ago

1.4.14

9 years ago

1.4.13

9 years ago

1.4.12

9 years ago

1.4.11

9 years ago

1.4.9

9 years ago

1.4.8

9 years ago

1.4.7

9 years ago

1.4.6

9 years ago

1.4.5

9 years ago

1.4.4

9 years ago

1.4.3

9 years ago

1.4.2

9 years ago

1.4.1

9 years ago

1.4.0

9 years ago

1.3.2

10 years ago

1.3.1

10 years ago

1.3.0

10 years ago

1.2.3

10 years ago

1.2.2

10 years ago

1.2.1

10 years ago

1.2.0

10 years ago

1.1.0

10 years ago