Get parent FB event from recurring FB event - facebook

Facebook recently added recurrences to their events. So a parent event 887104098135547, will have some event_times like so:
"event_times": [
{
"id": "887104171468873",
"start_time": "2018-06-22T20:00:00+0200",
"end_time": "2018-06-22T21:00:00+0200",
"ticket_uri": "http://www.s-d-a.pl/zapisy/id29/"
},
{
"id": "887104121468878",
"start_time": "2018-06-15T20:00:00+0200",
"end_time": "2018-06-15T21:00:00+0200",
"ticket_uri": "http://www.s-d-a.pl/zapisy/id29/"
},
...
If I start with event recurrence id 887104171468873, I can fetch it and treat it just like a FB Event (name, start_time, end_time, description, place, etc). It represents the singular instance of that recurrence, its times, and the attendees.
However, there is no way to get the parent templated event id, as far as I can tell. And likewise, there is no way to tell that this recurrence event id is actually a recurrence and not a full id. :(
This is causing problems for my system, where sometimes it fetches Pages and gets the parent IDs (and uses them in the system), and sometim[[es it fetches Users and gets the events they're RSVPing too, and gets the recurrence sub-events, with no great way to figure out how to canonicalize them back to the parent ID.
Has anyone else figured out how to do this?

Ok, looks like this is confirmed as being not possible. FB knows it is an issue and it is on their roadmap. https://developers.facebook.com/bugs/126142654873570/?ref=messenger_notif_bug_close

Related

How to design model for storing day wise timings?

I am designing a schema for doctor's appointments. The doctor will be given the option to update his/her timings for individual days of the month. Also there is no limit to months. For instance, the doctors will be able to update the timings for any days of future or current month. (Only previous dates will be disabled). The front end part has been done but what I fail to understand is how to create the mongo model for it. Of course I can not have dates for all months stored in the model. What is the method to address this problem? TIA
If it was me that had such project, I would start with 5 collections:
one for users (so you know who did what)
one for patients (recording all about the patient, including mobile number)
one for doctors (so you can show a list while registering time)
one for time registrations (with all details of the registration)
one for logging everything a user does
so you can go back in time and to know how did what... it's never to point the finger to the person that made the mistake but look at it as a very easy way to find out what it happened and how can you prevent it from happening again.
the content of each document is entirely up to you as that will change with exactly what and how you are doing
I would think about something between these lines:
// Users
{
username, hashedPassword, // credentials
permissions: [], // for when you start using permissions
active, // never delete data, just set the flag to "false", if, by GDPR rules you need to delete, you can change the name to "DELETED BY GDPR" and still maintain all references
}
// Patients
{
name,
address: { street, street2, city, zipcode, country }, // for invoicing proposes
mobile, // so you send them an SMS 24h before saying their appointment is "tomorrow"
}
// Doctors
{
name,
weekAvailability: [], // days of the week that a doctor is available as they normally work in more than one clinique
active, // never delete data, just set the flag to "false", if, by GDPR rules you need to delete, you can change the name to "DELETED BY GDPR" and still maintain all references
}
// Logs
{
action, // for example, "save", "add", "change"...
entity, // the collection name that the change happened
originalEntry, // the full document before changes
newEntry, // the full document after changes
timestamp, // the exact time of the change
user, // ref to users
}
// TimeRegistrations
{
user, // ref to users
patient, // ref to patients
doctor, // ref to doctors
title, description, appointmentStart, durationInMinutes,
}
regarding the infrastructure ... create an API (REST or GRAPHQL, the one you're most comfortable with) so you can separate the business logic from the frontend right from the start
your frontend (maybe React, Angular, VueJs) should call a proxy (nodeJs server running aside the frontend) to make authentications and call the API so all you should do in the frontend to be something like
fetch('/api/doctors')
.then(res => res.toJson())
.then(json => {
this.doctorsList = json
})
same as for authentication os a user where you can easily make use of a library to provide you with a JWT and easily maintain user logged in and with the right set of permissions
First approach but not good in your case i.e. One collection,
//doctors
{
_id: "",
appointments: [] // all appointments there
}
Second will be better but note in NoSql collection totally depends on how you want to get the data. Two collections:
//doctors
{
_id: "SOMETHING",
name: "SOMETHING"
}
//appointments
{
_id: "SOMETHING",
doctorId: "", // ref of doctor collection
appointmentAt: "",
appointmentAtMilli: "",
}

SurveyMonkey Email Collector Custom Values

In order to include information (like an order number) in a survey using an Email Collector, it's my understanding that this information needs to be stored in the Contact's custom variables. My concern is what happens if I am sending something like a customer satisfaction survey that needs to reference the order number, and the same customer (email address) places more than one order, and I have to send out more than one survey.
Will the custom values that are returned with the collectors/.../responses API call include the custom values at the time of the survey invite? Or will these be set to current values?
The custom values are stored on the response at the time the survey is taken. So if they change later, they will not change on the response. This will work fine as long as you don't sent out another survey with new custom values to the same contact before they respond to the previous one.
Just an FYI, there is also an option to set extra_fields on a recipient when adding recipients to an email collector (rather than on the contact).
POST /v3/collectors/<collector_id>/messages/<message_id>/recipients
{
"email": "test#example.com",
"extra_fields": {
"field1": "value1",
"field2": "value2"
}
}
I don't believe that data is stored with he response, but the recipient_id is and you can fetch the recipient by ID to get that data back.
Those are two options, you can see which one works best for you. The benefit of contact custom values is that you can view them and edit them from the web, whereas extra_fields are API only fields.

How to get attending guests count from event using FB Graph API?

I would like to get attending guests count from event using Facebook Graph API v2.1. I can't use FQL Query becouse it is deprecated after current version.
I can use /{event-id}/attending and sum all guests but this solution is very ineffective (queries are performed for a long time - usually >2000ms and it work only for ~1000 guests, not more).
If you make a call to the Event ID itself, you can add fields for attending_count, declined_count and maybe_count to get the totals easily.
Example:
https://graph.facebook.com/{event_id}?fields=attending_count,declined_count,maybe_count
If I do the following:
https://graph.facebook.com/468185256651918?fields=attending_count,declined_count,maybe_count
I see:
{
"attending_count": 304,
"declined_count": 277,
"maybe_count": 97,
"start_time": "2014-09-06T20:00:00+0100",
"id": "468185256651918"
}

How i can get all events from all registered users by using Graph API?

I work on iPhone application that grab events from different channel and show them on map.
Now i try to grab Facebook events in my DB.
I make this request
SELECT name, venue, location, start_time, update_time FROM event WHERE update_time>1358294400
But it doesn't work. Facebook return
{
"error": {
"message": "Error validating access token: Session has expired at unix time 1358528400. The current unix time is 1358761880.",
"type": "OAuthException",
"code": 190,
"error_subcode": 463
}
}
How can i get events by update_time ?
Thanks in advance.
I guess you can not. Since-
The WHERE clause must contain an indexable column. Such columns are marked with * in the tables.
and updated_time is not an indexable column. Only eid and name are indexable in the table event.
So, simply get all the data and then filter manually according to the updated_time

Create event with a venue with Graph API

Is it possible to set the venue when creating a location using Graph API? So that it's actually linked to the Facebook Place.
The goal is to show the map, but I'm fairly certain that for some reason requires a Place.
{
"name": "Dans till Zlips",
"start_time": "2011-09-11T00:00:00",
"end_time": "2011-09-11T03:00:00",
"location": "Yesterday",
"street": "Skyttevägen 4",
"city": "Vallentuna",
"country": "Sweden"
}
I think this should show a place. It does not. Setting longitude, latitude or venue id (suppose that's the id of the Place) does not work.
Right now I have to manually change the location in the event edit menu if I want to have it linked, which isn't really fun or feasible when you have a couple of hundred events.
There's a (currently undocumented) parameter which will mark a created event as taking place at a particular Place - When creating the event add the location_id parameter and set it to the ID of the Facebook Place you want