Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Is there a way to import facebook events? 4 years 7 months ago #22227

Hi:
Is there a way to import facebook events from page / group?
It could be great

Please Log in or Create an account to join the conversation.

Is there a way to import facebook events? 4 years 7 months ago #22230

  • Hoffi
  • Hoffi's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 2279
  • Thank you received: 449
Hi kbezadechorlo,

there is no facebook support provided by JEM. But maybe someone wrote a plugin or so and likes to share it. :)
Pessimists are optimists with experience!

Please Log in or Create an account to join the conversation.

Is there a way to import facebook events? 4 years 7 months ago #22237

Me too, I would like to know if someone did it :-)

and:
extensions.joomla.org/extension/facebook-event

and/or for programmers as inspiration or to look at the code:
wordpress.org/plugins/facebook-events-importer/
JEM 2.3.0 / JEM 2.3.0 with core mods (custom fields)
Joomla always up to date
php 7.3

Please Log in or Create an account to join the conversation.

Is there a way to import facebook events? 4 years 6 months ago #22343

Yes, I would like this too. There are some problems to overcome with importing Facebook events:
  1. Facebook doesn't have any category info, just title, date , time, location, description and image. So when importing, you need to store the event in some general category
  2. You need to create an extra table in the database to match Facebook event-locations with your JEM venue-id's
  3. You need to assign a user(id) to each event
  4. I'm not sure if Facebook exports a unique id with each event, but you need to identify each event if you want to an update for events already imported

Please Log in or Create an account to join the conversation.

Last edit: by stevent.

Is there a way to import facebook events? 3 years 11 months ago #23513

Hi
Only for to keep this tread alive, for some hints and for to push some jem developpers.

Googling a bit and on Facebook developers you can find a lot of tutorial on how to use the Events API Graph, it is tricky but not too much hard to to figure out how to import the FB events one by one on JEM.

Basically you need at first, to store in a custom field the Facebook event ID (saving and reloading the page or via ajax) and than you can work with the Facebook Events API Graph.

eg: API for event data:
(with this one you can retrieve all the event and venue data in one array but not, as stevent wrote, the category)
//import the data
$fbapi = "https://graph.facebook.com/EVENT_ID?access_token=YOUR_ACCESS_TOKEN";
$jsonpg = @file_get_contents($fbapi);  //  JSON of facebook events data from Api
$fbpage = json_decode($jsonpg, true, 512, JSON_BIGINT_AS_STRING);// decode JSON in array

//retrieve event data
$fbpage['name'] // event title
$fbpage['place']['name'] // venue name
etc... etc.

another tricky thing is that you need to save the image in the image folders for to use it.

eg: API for the image:
$imgfbapi = "https://graph.facebook.com/EVENT_ID?fields=cover&access_token=YOUR_ACCESS_TOKEN";
$jsonimg = @file_get_contents($imgfbapi);
$fbimage = json_decode($jsonimg, true, 512, JSON_BIGINT_AS_STRING);

// retrieve the link of the image fot to save it in the folders
$fbimage['cover']['source']; // link to FB image

// and then some php to save the image in the folders.

Most hard if you want to import all events from Facebook by location and date range at once
I spent several night googling and testing but I found only one well working solution (I tried also the WP plugin like hekla suggested and a lot of not working others)

here are the links:
github.com/tobilg/facebook-events-by-location#basics

and the php translation
github.com/PedroGabriel/facebook-events-by-location

hope this help.

Please Log in or Create an account to join the conversation.

Is there a way to import facebook events? 3 years 11 months ago #23514

I've found a nice tutorial for a php script that grabs de events of Facebook pages:

www.codeofaninja.com/2011/07/display-fac...to-your-website.html

The Facebook graph wil return data in JSON format:
Name of page/event owner, title, date, time, enddate, endtime, venue name, description of the event, category (which is usually not set by the event owner), url of the FB event, url to tickets, image (url), fb event id, modification date.

You'll need either an extra table that matches de Facebook venue names with your venue id's, or you need to update your venues table to match the exact Facebook names (and make sure no-one changes this).

A FB event has an unique id, in the form fb-1837997059776901. This will give you a match to update an event already in your table.
The date/time is in the format: 2017-03-24T14:17:54+0000 but this can easily be split into a separate date and time.

Biggest issue is that Facebook will not give you any category for the event, in most of the cases. So either you have to import the events into a default category, or you have to add the category afterwards by hand. (In some cases you might sure that a certain venue only has one type of events, like a cinema, but I wouldn't count on it 100%)

I've written a script that will output a table which I can import into Excel, and manually add the category and check if the venues are correctly matched. Then I manually import the data directly into my JEM events and cat-events tables. It's a bit of extra work, but it saves me time copying and pasting each separate FB event.

Maybe someone had ideas how to do this automatically with a script.

Please Log in or Create an account to join the conversation.

Last edit: by stevent.
  • Page:
  • 1
Time to create page: 0.582 seconds

Donate

If you find JEM useful and if you use it on your site, please consider a donation to the project.

Private Messages

You are not logged in.

Follow us......