Facebook Data Adapter

Facebook Data Adapter

Facebook Data Adapter

Asset Version: 1.0
  • Version 1.0
Last Published: Jul 18, 2017 By: Kony Team
101 0 0 13
Facebook is a popular free social networking website, online social media. Use Facebook Data Adapter to allow the registered users to keep in touch with friends, family and colleagues.

Requirements

  • Kony Fabric
 

Features 

  • Ready-to-use adapter and simple to import. 
  • Easy to make API calls through simple interaction directly from MobileFabric. 
  • Facilitates easy interaction with the other groups and profiles from within the App. 
  • Secure and authentic. 


Prerequisites 

  • Kony Fabric v8

Facebook is a very popular free social networking website, online media. Facebook data adapter allows the registered users to keep in touch with friends, family, and colleagues through the mobile app.

Facebook Data Adapter allows you to make API calls directly from MobileFabric. You can import the component into MobileFabric. After you import the component, you can use the MobileFabric console to make Facebook API calls and view the responses by creating and executing required operations. Here is a use case that describes the use of Facebook Data Adapter.

Use Case

Consider a case of a user who wants to connect to Facebook through mobile app, to view feeds, post feeds, and tag friends or family simultaneously to those feeds. The Facebook Data Adapter APIs can help with all these requirements:

  • User should be able to tag friends to his feed.
  • User should be able to post a Facebook feed.
  • User should be able to read posts.

In the above use case, you can develop the user interface and functionality of the mobile app using Kony Visualizer. To fetch the search results from Facebook, you can use MobileFabric with Facebook Data Adapter. In the MobileFabric console, you can create an integration service with the Facebook Data Adapter and create operations with the following Facebook APIs:

  1. get/(user_id)/taggable_friends: Retrieves IDs of friends to tag them to a feed.
  2. post/(user_id)/feed: Enables users to post feeds.
  3. get/(user_id)/feed: Enables the user to read the feeds.

After you create the necessary operations, you can integrate your mobile app with the integration service that you created with Facebook Data Adapter.

The following sections help you use the Facebook Data Adapter component:

Prerequisites

Before you start using the Facebook Data Adapter, ensure you have the following:

  1. An account with Facebook
  2. ClientID and Client Secret issued by Facebook
  3. A Kony account
  4. Kony MobileFabric 7.3

Importing Facebook Data Adapter

You can import Facebook Data Adapter into MobileFabric directly from the Kony Marketplace website or by importing the data adapter zip file.

To import the data adapter zip file, do the following:

  1. Log on to your Kony account. The Dashboard page appears by default.
  2. In the left pane, click the API Management menu. The APIs tab opens by default.
    amadeus_api_page.png
  3. Click the Custom Data Adapters tab. The Custom Data Adapter page appears.
    amadeus_cda_import.png
  4. Click Import. The Import Data Adapter dialog appears.
    amadeus_import_da.png
  5. Click IMPORT FROM KONY MARKETPLACE. The Import Data Adapter from Kony Marketplace dialog appears with a list of available data adapters.
  6. Click Import. The Facebook data adapter is listed on the Custom Data Adapters page.
    facebook_import.png

To import the data adapter zip file, do the following:

  1. Perform steps 1 through 4 in the above procedure
  2. Drag the component zip file into the Drag a Data Adapter box.

    Or

    Click browse. The Open dialog appears.

    Navigate to the location where you downloaded the component (zip file) on your computer, select the component, and click Open. The Import Data Adapter dialog shows the selected component.

    Note:

    Click Remove if the selected component is not the one that you want to import.

Creating an Identity Service with Facebook

Facebook provides support similar to OAuth2.0. We need to configure the identity in order to access the Facebook data with less rate limit.

Create an Identity service with service type as Facebook to connect with your Facebook site and respective account.

To create an Identity service with Facebook

  1. Log on to your Kony account. The Dashboard page appears by default.
  2. In the left pane, click the API Management menu. The APIs tab opens by default.
  3. Click the Identity tab. The Identity tab opens with a list of existing identity services.
  4. Click CONFIGURE NEW. The Identity Service tab opens.
  5. In the Name box, type a unique name for your service.
  6. From the Type of Identity list, select Facebook.
  7. In the Client ID box, type the Client ID provided by Facebook.
  8. In the Client Secret box, type the secret key provided by Facebook. These fields are mandatory.

facebook_auth.png

Click Add Default Scope to add default scope for the adapter. E-mail is the default scope for the Facebook Identity Service. Click Save.

If the details provided are valid, the MobileFabric application authenticates to your Facebook account and allows you to make the API calls.

Creating an Integration Service with Facebook

After you import Facebook Data Adapter into MobileFabric, you must create an integration service with service type as Facebook to connect with your Facebook developer site.

To create an integration service with Facebook, do the following:

  1. Log on to your Kony account. The Dashboard page appears by default.
  2. In the left pane, click the API Management menu. The APIs tab opens by default.
  3. Click the Integration tab. The Integration tab opens with a list of existing integration services.
  4. Click CONFIGURE NEW. The Service Definition tab opens.
  5. In the Name box, type a unique name for your service.
  6. From the Service Type list, select Facebook.
    Note:

    The Facebookis listed only after you import the Facebook Data Adapter into MobileFabric.

  7. Under Authentication select Use Existing Identity provider. From the drop down list select facebookIdentity.
    facebook_service.png
  8. Click Save.

If the details provided are valid, the MobileFabric service connects to your Facebook developer site and allows you to make the API calls.

Refer to Integration Services for more information on creating and using integration services.

Creating an Operation

To make any API call in the MobileFabric console, you must create an operation for the respective API and then execute the operation. Executing an operation involves making the API call and displaying the response. For more information, see Executing an Operation.

This section provides steps to create an operation for the post/(user_id)/feed API.

Steps to create an operation for the post/(user_id)/feed API:

  1. Log on to your Kony account. The Dashboard page appears by default.
  2. In the left pane, click the API Management menu. The APIs tab opens by default.
  3. Click the Integration tab. The Integration page appears with a list of existing integration services.
  4. From the list of integration services, select the integration service that you have created with service type as Facebook. The Service Definition tab of the selected integration service opens by default.
  5. Click the Operations List tab. The Operations List tab opens.
  6. Click the context menu arrow to expand the Please Select list. The Facebook services is displayed.
  7. Click the plus icon to expand the Facebook list.
  8. Click the plus icon to expand the Services list, and select post/(user_id)/feed.
    facebook_op_sel.png
  9. Click ADD OPERATION. The post/(user_id)/feed operation is listed in the Configured Operations section.
    facebook_oplist.png
Note:

You can follow the same steps to create operations for other methods, but ensure that you select the required API.

You can create multiple operations with required APIs and save them in the Configured Operations section. You can then execute the operations when ever required.

Executing an Operation

Executing an operation involves making the API call by setting the necessary parameters and displaying the response. The procedure to execute any operation is same, but the request parameters of the APIs vary. For more information on request parameters of each API, refer Facebook API Catalog.

This section provides steps to execute the post/(user_id)/feed operation (explained in Creating an Operation).

Steps to execute the post/(user_id)/feed operation:

  1. Log on to your Kony account. The Dashboard page appears by default.
  2. In the left pane, click the API Management menu. The APIs tab opens by default.
  3. Click the Integration tab. The Integration tab opens with a list of existing integration services.
  4. From the list of integration services, select the integration service that you have created with service type as Facebook. The Service Definition tab of the selected integration service opens by default.
  5. Click the Operations List tab.
  6. Under the Configured Operations section, click the post/(user_id)/feed operation. The post/(user_id)/feed tab opens with the Request Input sub-tab opened by default.
    facebook_params.png
  7. In the Name box, the name of the operation is displayed by default. If you want, you can change the name.
  8. On the Request Input tab, in the Body section, for the following parameters, specify the values in the respective boxes under the Test Value column.

    Mandatory Parameters

    • user_id: The user id of a person on whose time-line you want to post the feed.
    • message: The text in the post. It takes string values.
  9. Click SAVE AND FETCH RESPONSE. The Output Result dialog appears with the response. Otherwise, the Output Result shows an error.


facebook_output_resp.png