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
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)
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.
If you find JEM useful and if you use it on your site, please consider a donation to the project.
You are not logged in.
JEM and this site is not affiliated with or endorsed by The Joomla! Project™. Any products and services provided through this site are not supported or warrantied by The Joomla! Project or Open Source Matters, Inc. Use of the Joomla!® name, symbol, logo and related trademarks is permitted under a limited license granted by Open Source Matters, Inc.