💬 Open Source App Framework to build streaming apps with real-time data - 💎 Build real-time data pipelines and make real-time data universally accessible - 🤖 Join historical and real-time data in the stream to create smarter ML and AI applications. - ⚡ Standardize complex data ingestion and stream data to apps with pre-built connectors
As a developer receiving a message from a Facebook user who messaged a Facebook page that is validly connected as a channel of source type "facebook",
in case the tuple of a Facebook page id and a page scoped user id (PSID) is unknown to my Airy instance,
I want to be able to asynchronously fetch the user profile information via the Facebook User Profile API and have the returned data stored in the system,
so that I can more easily distinguish who messaged the relevant Facebook page
## Acceptance Criteria
GIVEN A channel of source type "facebook" is connected to my Airy Core instance,
GIVEN the Facebook-specific parameter subject_to_new_eu_privacy_rules is either false, null, or undefined for the relevant channel,
GIVEN the optional user fields locale, timezone and gender that require both app- and page-level approval by Facebook have not been specified for the relevant channel when it was connected,
WHEN a new message arrives via the Facebook webhook from an unknown tuple of a Facebook page id and a page scoped user id (PSID),
THEN in case such request succeeds, the user profile information of the contact for the relevant conversation in Airy is updated with the information received from the User Profile API,
THEN in case such request succeeds, the user profile picture should be uploaded to the cloud storage provider as configured in the relevant Airy instance configuration settings and the avatar image url of the contact for the relevant conversation should be updated accordingly,
GIVEN A channel of source type "facebook" is connected to my Airy Core instance,
GIVEN the Facebook-specific parameter subject_to_new_eu_privacy_rules is either false, null, or undefined for the relevant channel,
GIVEN one or more of the optional user fields locale, timezone and gender that require both app- and page-level approval by Facebook have been specified for the relevant channel when it was connected,
WHEN a new message arrives via the Facebook webhook from an unknown tuple of a Facebook page id and a page scoped user id (PSID),
THEN an asynchronous request to the Facebook User Profile API (https://developers.facebook.com/docs/messenger-platform/identity/user-profile/) is being sent for the PSID of the relevant Facebook user (see Dev Notes below) - whereby the fields in the request are being extended by the relevant fields locale, timezone and/or gender for which it has been specified for the relevant channel when it was connected that an approval has been granted by Facebook to query the relevant user field for both the Facebook App and the relevant Facebook page,
THEN in case such request succeeds, the user profile information of the contact for the relevant conversation in Airy is updated with the information received from the User Profile API,
THEN in case such request succeeds, the user profile picture should be uploaded to the cloud storage provider as configured in the relevant Airy instance configuration settings and the avatar image url of the contact for the relevant conversation should be updated accordingly,
Send the following GET request with the PSID of the contact and the PAGE_TOKEN as parameters in the url:
Request:
curl --request GET \
--url 'https://graph.facebook.com/v9.0/<PSID>?access_token=<PAGE_TOKEN>&fields=first_name,last_name,profile_pic'
Response:
{
"first_name": "Peter",
"last_name": "Chang",
"profile_pic": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xpf1/v/t1.0-1/p200x200/13055603_10105219398495383_8237637584159975445_n.jpg?oh=1d241d4b6d4dac50eaf9bb73288ea192&oe=57AF5C03&__gda__=1470213755_ab17c8c8e3a0a447fed3f272fa2179ce",
"locale": "en_US", // optional - only there if permission has been granted & the field has been set in the request
"timezone": -7, // optional - only there if permission has been granted & the field has been set in the request
"gender": "male" // optional - only there if permission has been granted & the field has been set in the request
}
In case you send a request ton include a field that you don't have permission for either on App-level or page level, the relevant property will not just be empty, but the whole request will fail.
From the successful response download the image specified at profile_pic as the link will expire and upload it to a cloud storage provider as chosen by the relevant setting in the Airy Instance configuration / environment variables.
Update the conversation / contact profile with the relevant data received from the Facebook User Profile API request and the uploaded user profile picture / avatar image url.
As a developer receiving a message from a Facebook user who messaged a Facebook page that is validly connected as a channel of source type "facebook", in case the tuple of a Facebook page id and a page scoped user id (PSID) is unknown to my Airy instance, I want to be able to asynchronously fetch the user profile information via the Facebook User Profile API and have the returned data stored in the system, so that I can more easily distinguish who messaged the relevant Facebook page
## Acceptance Criteria
subject_to_new_eu_privacy_rules
is eitherfalse
,null
, orundefined
for the relevant channel,locale
,timezone
andgender
that require both app- and page-level approval by Facebook have not been specified for the relevant channel when it was connected,## Acceptance Criteria
subject_to_new_eu_privacy_rules
is eitherfalse
,null
, orundefined
for the relevant channel,locale
,timezone
andgender
that require both app- and page-level approval by Facebook have been specified for the relevant channel when it was connected,locale
,timezone
and/orgender
for which it has been specified for the relevant channel when it was connected that an approval has been granted by Facebook to query the relevant user field for both the Facebook App and the relevant Facebook page,## Acceptance Criteria
subject_to_new_eu_privacy_rules
istrue
for the relevant channel,## Design Notes
## Dev Notes
Request:
Response:
In case you send a request ton include a field that you don't have permission for either on App-level or page level, the relevant property will not just be empty, but the whole request will fail.
From the successful response download the image specified at
profile_pic
as the link will expire and upload it to a cloud storage provider as chosen by the relevant setting in the Airy Instance configuration / environment variables.Update the conversation / contact profile with the relevant data received from the Facebook User Profile API request and the uploaded user profile picture / avatar image url.
## Definition of Done