TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook User's Guide

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook User's Guide
TIBCO ActiveMatrix BusinessWorks™ Plug-in
for Facebook
User's Guide
Software Release 6.0
April 2015
Two-Second Advantage®
2
Important Information
SOME TIBCO SOFTWARE EMBEDS OR BUNDLES OTHER TIBCO SOFTWARE. USE OF SUCH
EMBEDDED OR BUNDLED TIBCO SOFTWARE IS SOLELY TO ENABLE THE FUNCTIONALITY
(OR PROVIDE LIMITED ADD-ON FUNCTIONALITY) OF THE LICENSED TIBCO SOFTWARE. THE
EMBEDDED OR BUNDLED SOFTWARE IS NOT LICENSED TO BE USED OR ACCESSED BY ANY
OTHER TIBCO SOFTWARE OR FOR ANY OTHER PURPOSE.
USE OF TIBCO SOFTWARE AND THIS DOCUMENT IS SUBJECT TO THE TERMS AND
CONDITIONS OF A LICENSE AGREEMENT FOUND IN EITHER A SEPARATELY EXECUTED
SOFTWARE LICENSE AGREEMENT, OR, IF THERE IS NO SUCH SEPARATE AGREEMENT, THE
CLICKWRAP END USER LICENSE AGREEMENT WHICH IS DISPLAYED DURING DOWNLOAD
OR INSTALLATION OF THE SOFTWARE (AND WHICH IS DUPLICATED IN THE LICENSE FILE)
OR IF THERE IS NO SUCH SOFTWARE LICENSE AGREEMENT OR CLICKWRAP END USER
LICENSE AGREEMENT, THE LICENSE(S) LOCATED IN THE “LICENSE” FILE(S) OF THE
SOFTWARE. USE OF THIS DOCUMENT IS SUBJECT TO THOSE TERMS AND CONDITIONS, AND
YOUR USE HEREOF SHALL CONSTITUTE ACCEPTANCE OF AND AN AGREEMENT TO BE
BOUND BY THE SAME.
This document contains confidential information that is subject to U.S. and international copyright laws
and treaties. No part of this document may be reproduced in any form without the written
authorization of TIBCO Software Inc.
TIBCO, Two-Second Advantage, TIBCO ActiveMatrix BusinessWorks, TIBCO ActiveMatrix
BusinessWorks Plug-in for Facebook, TIBCO Business Studio, and TIBCO Enterprise Administrator are
either registered trademarks or trademarks of TIBCO Software Inc. in the United States and/or other
countries.
Enterprise Java Beans (EJB), Java Platform Enterprise Edition (Java EE), Java 2 Platform Enterprise
Edition (J2EE), and all Java-based trademarks and logos are trademarks or registered trademarks of
Oracle Corporation in the U.S. and other countries.
All other product and company names and marks mentioned in this document are the property of their
respective owners and are mentioned for identification purposes only.
THIS SOFTWARE MAY BE AVAILABLE ON MULTIPLE OPERATING SYSTEMS. HOWEVER, NOT
ALL OPERATING SYSTEM PLATFORMS FOR A SPECIFIC SOFTWARE VERSION ARE RELEASED
AT THE SAME TIME. SEE THE README FILE FOR THE AVAILABILITY OF THIS SOFTWARE
VERSION ON A SPECIFIC OPERATING SYSTEM PLATFORM.
THIS DOCUMENT IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
THIS DOCUMENT COULD INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL
ERRORS. CHANGES ARE PERIODICALLY ADDED TO THE INFORMATION HEREIN; THESE
CHANGES WILL BE INCORPORATED IN NEW EDITIONS OF THIS DOCUMENT. TIBCO
SOFTWARE INC. MAY MAKE IMPROVEMENTS AND/OR CHANGES IN THE PRODUCT(S)
AND/OR THE PROGRAM(S) DESCRIBED IN THIS DOCUMENT AT ANY TIME.
THE CONTENTS OF THIS DOCUMENT MAY BE MODIFIED AND/OR QUALIFIED, DIRECTLY OR
INDIRECTLY, BY OTHER DOCUMENTATION WHICH ACCOMPANIES THIS SOFTWARE,
INCLUDING BUT NOT LIMITED TO ANY RELEASE NOTES AND "READ ME" FILES.
Copyright © 2012-2015 TIBCO Software Inc. ALL RIGHTS RESERVED.
TIBCO Software Inc. Confidential Information
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
3
Contents
TIBCO Documentation and Support Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4
Plug-in Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6
Creating a Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Configuring a Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Testing a Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Deploying an Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
TIBCO Business Studio Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Authentication and Authorization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Introduction to Facebook Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Introduction to Authentication Tokens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Getting App Access Token . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Getting Default Access Token . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Getting Long-Term Authentication Token . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Facebook Palette . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14
Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Graph Query . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
FQL Query . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Publish . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Delete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
RealTimeListener . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Configuring Proxy Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Configuring Inbound Proxy Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Configuring Outbound Proxy Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Encrypting a Password . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Using Encrypted Password . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Working with the Sample Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Importing the Sample Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Working with the ParsingPageFeeds-ProductDirection Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Configurations for the ParsingPageFeeds Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Configurations for the ProductDirection Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Managing Logs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Log Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Setting Up Log Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Exporting Logs to a File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
4
TIBCO Documentation and Support Services
All TIBCO documentation is available on the TIBCO Documentation site, which can be found here:
https://docs.tibco.com
Product-Specific Documentation
Documentation for TIBCO products is not bundled with the software. Instead, it is available on the
TIBCO Documentation site. To directly access documentation for this product, double-click the
following file:
TIBCO_HOME/release_notes/TIB_bwpluginfacebook_version_docinfo.html
where TIBCO_HOME is the top-level directory in which TIBCO products are installed. On Windows,
the default TIBCO_HOME is C:\Program Files\tibco. On UNIX systems, the default TIBCO_HOME
is /opt/tibco.
The following documents for this product can be found in the TIBCO Documentation Library:
●
TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook Installation
●
TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook User's Guide
●
TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook Release Notes
The following documents provide additional information and can be found in the TIBCO
Documentation Library:
●
TIBCO ActiveMatrix BusinessWorks Documentation
●
TIBCO Enterprise Administrator User's Guide
How to Contact TIBCO Support
For comments or problems with this manual or the software it addresses, contact TIBCO Support as
follows:
●
For an overview of TIBCO Support, and information about getting started with TIBCO Support,
visit this site:
http://www.tibco.com/services/support
●
If you already have a valid maintenance or support contract, visit this site:
https://support.tibco.com
Entry to this site requires a user name and password. If you do not have a user name, you can
request one.
How to Join TIBCOmmunity
TIBCOmmunity is an online destination for TIBCO customers, partners, and resident experts. It is a
place to share and access the collective experience of the TIBCO community. TIBCOmmunity offers
forums, blogs, and access to a variety of resources. To register, go to:
https://www.tibcommunity.com
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
5
Plug-in Overview
You can use TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook to publish, search, delete,
query, and listen to Facebook data.
TIBCO ActiveMatrix BusinessWorks™ is a leading integration platform that can integrate a wide
variety of technologies and systems within enterprise and on cloud. TIBCO ActiveMatrix
BusinessWorks includes an Eclipse-based graphical user interface (GUI) provided by TIBCO Business
Studio™ for design, testing, and deployment. If you are not familiar with TIBCO ActiveMatrix
BusinessWorks, see the TIBCO ActiveMatrix BusinessWorks documentation for more details.
TIBCO ActiveMatrix BusinessWorks supports plug-in that extends the palette functionality. After
installing the plug-in, activities for the plug-in become available in the TIBCO Business Studio. Add the
plug-in activities to the business process you are designing, and integrate them with the process flow.
At run time, the plug-in activities are executed as part of the ActiveMatrix BusinessWorks process
execution.
This manual focuses on an overview of each activity. For detailed information, see Facebook Developer
Documentation.
TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook is unique in its powerful integration
capabilities, and also unique in its dependency on another company's product. Because the plug-in uses
the public API of the platform, in this case, the Facebook Graph API, any open issues that have been
reported against the third-party API result in problems with the plug-in. If Facebook makes changes to
their public API, the plug-in functionality might become limited or might change.
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
6
Getting Started
This tutorial is designed for the beginners who want to use TIBCO ActiveMatrix BusinessWorks Plugin for Facebook User's Guide in TIBCO Business Studio.
All the operations are performed in TIBCO Business Studio. See TIBCO Business Studio Overview to
get familiar with TIBCO Business Studio.
A basic procedure of using TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook includes:
1. Creating a Project
2. Configuring a Process
3. Testing a Process
4. Deploying an Application
Creating a Project
BusinessWorks application modules are Eclipse projects, they are created in TIBCO Business Studio
and contain various resources.
An Eclipse project is an application module configured for TIBCO ActiveMatrix BusinessWorks. An
application module is the smallest unit of resources that is named, versioned, and packaged as part of
an application.
Procedure
1. Start TIBCO Business Studio using one of the following ways:
●
●
Microsoft Windows: click Start > All Programs > TIBCO > TIBCO_HOME > TIBCO Business
Studio version_number > Studio for Designers.
Mac OS and Linux: run the TIBCO Business Studio executable file located in the TIBCO_HOME/
directory.
studio/version_number/eclipse
2. From the menu, click File > New > BusinessWorks Resources to open the BusinessWorks Resource
wizard.
3. In the "Select a wizard" dialog, click BusinessWorks Application Module and click Next to open
the New BusinessWorks Application Module wizard.
4. In the Project dialog, configure the project that you want to create:
a) In the Project name field, enter a project name.
b) By default, the created project is located in the workspace current in use. If you do not want to
use the default location for the project, clear the Use default location check box and click Browse
to select a new location.
c) Use the default version of the application module, or enter a new version in the Version field.
d) Keep the Create empty process and Create Application check boxes selected to automatically
create an empty process and an application when creating the project.
e) Select the Use Java configuration check box if you want to create a Java module.
A Java module provides the Java tooling capabilities.
f) Click Finish to create the project.
Result
The project with the specified settings is displayed in the Project Explorer view.
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
7
Configuring a Process
After creating a project, an empty process is created. You can add activities to the empty process to
complete a task. For example, publish an object.
Prerequisites
Ensure that you have created an empty process when Creating a Project.
Procedure
1. In the Project Explorer view, click the created project and open the empty process from the
Processes folder.
2. Select an activity from the Palette view and drop it in the Process editor.
For example, select and drop the Timer activity from the General Activities palette and the Publish
activity from the Facebook palette.
3. Drag the
icon to create a transition between the added activities.
4. Configure the added Facebook activities, as described in Facebook Palette.
5. Click File > Save to save the project.
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
8
Testing a Process
After configuring a process, you can test the process to check if it completes your task.
Prerequisites
Ensure that you have configured a process, as described in Configuring a Process.
Procedure
1. On the toolbar, click
Debug > Debug Configurations.
2. Click BusinessWorks Application > BWApplication in the left panel.
By default, all the applications in the current workspace are selected in the Applications tab. Ensure
that only the application you want to debug is selected in the Applications tab in the right panel.
3. Click Debug to test the process in the selected application.
TIBCO Business Studio changes to the Debug perspective. The debug information is displayed in
the Console view.
4. In the Debug tab, expand the running process and click an activity.
5. In the upper-right corner, click the Job Data tab, and then click the Output tab to check the activity
output.
Deploying an Application
After testing, if the configured process works as expected, you can deploy the application that contains
the configured process into a runtime environment, and then use the bwadmin utility to manage the
deployed application.
Before deploying an application, you must generate an application archive, which is an enterprise
archive (EAR) file that is created in TIBCO Business Studio.
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
9
Deploying an application involves the following tasks:
1. Upload an application archive.
2. Deploy an application archive.
3. Start an application.
See TIBCO ActiveMatrix BusinessWorks Administration for more details about how to deploy an
application.
TIBCO Business Studio Overview
TIBCO Business Studio is an Eclipse-based integration development environment that is used to
design, develop, and test ActiveMatrix BusinessWorks applications.
TIBCO Business Studio provides a workbench in which you can create, manage, and navigate resources
in your workspace. A workspace is the central location on your machine where all data files are stored.
The workbench consists of:
●
Menu: Contains menu items such as File, Edit, Diagram, Navigate, Search, Project, Run, Window,
and Help.
●
Toolbar: Contains buttons for frequently used commands such as New
Disable Business Studio Capabilities
, Save
, Enable/
, Create a new BusinessWorks Application Module
Create a new BusinessWorks Shared Module
, Debug
, Run
,
, and so on.
●
Perspective: Contains an initial set and layout of views that are required to perform a certain task.
TIBCO Business Studio launches the Modeling perspective by default. You can change the
perspective from the menu Window > Open Perspective > Perspective_Name.
●
View: Displays resources. For example, the Project Explorer view displays the ActiveMatrix
BusinessWorks applications, modules, and other resources in your workspace, and the Properties
view displays the properties for the selected resource. You can open a view from the menu Window
> Show View > View_Name.
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
10
●
Editor: Provides a canvas to configure, edit, or browse a resource. Double-click a resource in a view
to open the appropriate editor for the selected resource. For example, double-click an ActiveMatrix
BusinessWorks process (MortgageAppConsumer.bwp) in the Project Explorer view to open the
process in the editor.
●
Palette: Contains a set of widgets and a palette library. A palette groups activities that perform
similar tasks and provide quick access to activities when configuring a process.
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
11
Authentication and Authorization
The plug-in uses the OAuth 2.0 protocol for authentication and authorization. Before using the plug-in,
you have to get the authentication parameters to authorize Facebook applications.
The protocol itself and how Facebook uses the protocol might change. Therefore, this document only
provides an example.
Introduction to Facebook Authentication
Facebook authentication is required to conduct plug-in activities.
Each activity in the plug-in includes a token field in the Input tab. You must specify an appropriate
authentication token in the token field to run the process.
The Facebook implementation of the OAuth 2.0 protocol consists of three steps:
User authentication
Ensures that the user who logs into Facebook is a valid Facebook user, that is, a user with a valid
Facebook user name and password.
App authorization
Ensures that when your app asks a user for access, the user knows exactly what data and capabilities
they are providing to your application.
Most TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook applications do not ask users for
access but work with publicly available user data instead.
App authentication
Ensures that users are giving data to your app rather than a different app.
After your app completes these steps, the app is issued an access token that supports the app to access
the user's information if it has appropriate permissions. For example, your app might be able to
examine the posts of a user and of all friends of the user.
For background information on Facebook Authentication, go to the Core Concepts section of the
Facebook Developer Documentation and select Authenticating an App in the sidebar. Do not click one of
the authentication flow links on the first page.
Introduction to Authentication Tokens
An authentication token stores information related to permissions, token generation and expiration.
Access Token
An access token is a random string that gives an app temporary and secure access to Facebook APIs.
An access token is created on behalf of a person, a Facebook Page or an app. The token is generated
during the last step of the login flow. Facebook SDKs handle the generation and storage of tokens
automatically. Apps using other methods have to follow the login flow to create tokens.
A token stores information about granted permissions, when the token expires and which app
generates it. To maintain information security, almost all API calls at Facebook required to have an
access token that passed in the parameters of the request.
●
User Token: User tokens enable you to test your apps. They expire like any other user access token
and cannot be hard coded into your apps.
●
App Token: App tokens do not expire and must be kept confidential as they are related to your
app secret.
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
12
●
Page Token: Page tokens are similar to user token, except that they provide permission to APIs
that read, write, or modify the data belong to a Facebook page.
Getting App Access Token
You can get an App access token to modify and read the app settings.
Procedure
1. Log into https://developers.facebook.com/tools/explorer/.
2. Select your application from the Application list.
3. Select v2.2 from the API Version list.
4. Select Get Access Token from the Get Token list.
5. On the Select Permissions window, select the necessary permissions, and then click Get Access
Token.
Result
The App access token is generated in the Access Token field. You can use the access token ID in the
token field in the Input tab of different activities.
Getting Default Access Token
An access token is required for authorizing the access to Facebook applications.
Procedure
1. Log into https://developers.facebook.com/tools/explorer/.
2. Select Graph API Explorer from the Application list at the top of the page.
3. Select v2.2 from the API Version list.
4. Select Get Access Token from the Get Token list.
5. Click the Get Access Token button.
6. On the Select Permissions window, select the necessary permissions, and then click Get Access
Token.
Result
The access token is generated in the Access Token field.
Getting Long-Term Authentication Token
By default, a Facebook access token expires after two hours. You can extend the token to be valid for
sixty days.
Prerequisites
Before generating the long-term access token, you have to get your APP ID, APP secret , and your App
access token.
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
13
Procedure
1. Copy the following URL to a TXT file:
https://graph.facebook.com/oauth/access_token?
client_id=your_app_id&client_secret=your_app_secret&grant_type=fb_exchange_token&
fb_exchange_token=your_regular_access_token
2. Change the your_app_id, your_app_secret, and your_regular_access_token to your own APP ID, APP
secret, and your App access token.
3. Copy the URL to your browser and press Enter.
Result
The long-term access token is displayed in the browser.
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
14
Facebook Palette
The Facebook Palette contains six activities to search, query, publish, delete, and listen to Facebook
data.
After installing the plug-in, a Facebook palette is available in TIBCO BusinessWorks Studio, which
contains the following activities:
●
Search
You can use the Search activity to search public objects in the social graph. Searchable objects
include public user, page, event, group, and place.
●
Graph Query
You can use the Graph Query activity to search for a specific object and its details. It does not return
results across all Facebook objects like Search but focuses on a single object. A Graph Query
searches a much smaller space than a Search activity.
●
FQL Query
You can use the FQL Query activity to define and execute a Facebook Query Language (FQL) query.
FQL Query queries the data available in the Facebook social graph. In contrast to the Graph Query
activity and the Search activity, search results are narrowed down.
●
Publish
You can use the Publish activity to publish to the Facebook social graph using HTTP POST requests.
●
Delete
The Delete activity allows you to delete objects in the social graph. For example, you are able to
delete a comment or delete a like for a post.
●
RealTimeListener
The RealTimeListener activity is a TIBCO ActiveMatrix BusinessWorks starter activity. It enables
ActiveMatrix BusinessWorks customers to subscribe to changes in data in Facebook. By listening to
changes, rather than polling the Facebook servers, an ActiveMatrix BusinessWorks application
improves reliability and decreases load times.
Search
The Search activity is used to search public objects in the social graph. Searchable objects include public
user, page, event, group, and place.
When you use the Search activity, you have to add quotes around strings that include special
characters. If the string for which you want to search includes double quotes, or if some text repeats in
the string, you have to add a set of single quotes. For example, to search for "fun fun fun" , enter the text
'"fun fun fun"'.
General
You can specify the object to search in the General tab of the Search activity.
Field
Module
Property?
Description
Name
No
Name of the Search activity.
Object
Type
No
The Facebook objects to search for. Available object types are User,
Event, Group, Page, Place.
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
15
Description
In the Description tab, you can enter a short description for the Search activity.
Input
You can find the following information in the Input tab of the Search activity.
Input Item
Data
Type
Description
searchText
String
Text used to search for data in Facebook.
center
String
The center of your search location, you specify latitude and
longitude in this parameter.
This field appears only if you select Place from the
Object Type list in the General tab.
distance
String
The distance between the center and search range. Along with
the parameter is used to narrow your search to a specific
location range.
center,
This field appears only if you select Place from the
Object Type list in the General tab.
maxNumOfPages
Integer
The maximum number of pages that used to display retrieved
records that the process performs. The default value is 1.
If you set it to -1, all the retrieved records that Facebook returns are
displayed, regardless of the page size limit.
pageSize
Integer
Number of items displayed on one page.
If you specify -1 for maxNumOfPages, the value of pageSize is
ignored.
The number of results returned is not always equal to the
value of maxNumOfPages multiplies pageSize. For details
on this, see https://developers.facebook.com/blog/post/
478/.
additionalParams
String
Additional parameters, depending on the object you select in the
General tab.
token
String
The Facebook authentication token (OAuth token) to access the
data.
Output
XML representation of the returned object. The information available in the object depends on the
object selected in the General tab and on the permission settings for that object.
Fault
The Fault tab lists exceptions that are thrown by the Search activity.
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
16
Fault
Thrown When...
FBPluginException
The plug-in does not send the request or parse the response. A summary
of the error returned from Facebook is displayed in a dialog.
If you get this error with a process that previously worked properly,
Facebook might have added fields to the object that the activity is using.
Check the input field of the activity for missing input, and see Facebook
documentation for details.
FBConnectionException
The HTTP connection to Facebook is not available, or another connection
problem that is unrelated to authorization exists.
FBOauthException
If your token is invalid, your token expires, or you do not have
permissions to retrieve or publish the information you want to retrieve
or publish.
The error message from Facebook is not specific and you have to explore
whether the problem is related to the token or to permissions.
Graph Query
The Graph Query activity is used to query social graph.
Facebook social graph represents connections between Facebook objects such as users, links, and pages.
You can use the Graph Query to search for a specific object and its details. It does not return results
across all Facebook objects like the Search activity but focuses on a single object. A Graph Query
activity searches a much smaller space than a Search activity, and it requires the ID of the object you
query.
General
In the General tab of the Graph Query activity, you can specify the query name, select an object to
query, and specify the connections of the object that you are interested in.
Field
Module
Property?
Description
Name
No
Name of the Graph Query activity.
Object
No
One of the Facebook objects to be queried.
Query Edges
(Connection )
No
Select this check box to query edge or connections between objects.
Edge
(Connection)
No
Type of edge or connection to query. Edges are the connections, or
relationships, between nodes, such as friendships between people,
likes of Pages, or the list of comments on a photo.
For example, if you select Post from the Object list, you can select
and Likes from the Edge (Connection) list.
Comments
See the Facebook Developer Documentation for details.
This field displays only when you select the Query Edges
(Connection) check box.
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
17
Description
In the Description tab, you can enter a short description for the Graph Query activity.
Input
Information in the Input tab varies according to Object specified in the General tab.
Input Item
Data
Type
graphObjectID
String
Description
Run the process twice to retrieve information, with different values
in the Input tab.
1. Use your own user ID or the string "me", including the double
quotes to retrieve the object you want to query. For example, if
you want to query a friend's connections, you have to know the
user ID of your friend.
2. In the second Graph Query activity, specify the ID of the object
that you want to retrieve information about.
maxNumOfPages
Integer
The maximum number of pages that is used to display retrieved
records that the process performs. The default value is 1.
If you set it to -1, all the retrieved records that Facebook returns are
displayed, regardless of the page size limit.
pageSize
Integer
Number of items displayed on one page.
If you specify -1 for maxNumOfPages, the value of pageSize is
ignored.
recordOffset
Long
A number that will be deducted from the retrieved records number.
This field displays only when you select the Edge
(Connection) check box in the General tab.
since
String
The start time of what you want to query.
until
String
The end time of what you want to query.
BuildInDelay
Integer
The minimum sleep time a process needed to run the activity.
additionalParams
String
Additional parameters, depending on the selection you made in the
General tab.
token
String
The Facebook authentication token (OAuth token) to access the
data.
Output
The returned object is displayed in the XML format. The information available in the object depends on
the object selected in the General tab and the permissions settings for that object. For example, if you
select Link from the Object list, and select Comments from the Edge (Connection) list to get all
comments on a link, the following fields are listed.
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
18
●
id
●
success
●
metadata
●
from
●
message
●
createdTime
●
likeCount
●
canRemove
●
userLikes
●
canComment
●
canHide
●
isHiddern
Fault
The Fault tab lists exceptions that are thrown by the Graph Query activity.
Fault
Thrown When...
FBPluginException
The plug-in does not send the request or parse the response. A summary
of the error returned from Facebook is displayed in a dialog.
If you get this error with a process that previously worked properly,
Facebook might have added fields to the object that the activity is using.
Check the input field of the activity for missing input, and see Facebook
documentation for details.
FBConnectionException
The HTTP connection to Facebook is not available, or another connection
problem that is unrelated to authorization exists.
FBOauthException
If your token is invalid, your token expires, or you do not have
permissions to retrieve or publish the information you want to retrieve
or publish.
The error message from Facebook is not specific and you have to explore
whether the problem is related to the token or to permissions.
FQL Query
The FQL Query activity is used to define and execute a Facebook Query Language (FQL) query. FQL
Query queries the data available in the Facebook social graph. In contrast to the Graph Query activity
and the Search activity, search results are narrowed down.
See the Facebook Developer Documentation for details on how FQL Query works.
General
You can define the query which you want to conduct in the General tab of the FQL Query activity,
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
19
Field
Module
Property?
Description
Name
No
Name of the FQL Query activity.
Table
No
List of tables over which you run the FQL Query. See the Facebook
Developer Documentation for details on the definition of each table.
For example, Comment queries this table to obtain comments
associated with a Facebook object, for example, comments associated
with a Post, Link, Video, or Photo.
Columns
No
An FQL table that documents columns in other FQL tables.
Click Pick Columns to display a multi-choice table, select proper
check boxes, and click OK.
Where
Yes
WHERE clause for the FQL Query.
Description
In the Description tab of the FQL Query, you can enter a short description for the FQL Query activity.
Input
The Input tab lists information in the following table.
Input Item
Data
Type
whereClause
String
Description
Optional field to specify the WHERE clause of the FQL Query activity
at run time. It overrides the whereClause specified in the General tab
at run time.
Use this field if a BusinessWorks activity feeds data to this activity, and
you want to use something in the input data as the query string.
Specify the WHERE clause only. If the syntax of the text in
this field does not match the WHERE clause syntax, an error
results.
token
String
The Facebook authentication token (OAuth token) to access the data.
Output
The information available in the object depends on the object selected in the General tab and the
permissions associated with the token.
The plug-in supports a subset of the output that is returned by the Facebook FQL Query API. But if the
Facebook Query API changes, those fields are possibly not available.
Fault
The Fault tab lists exceptions that are thrown by the FQL Query activity.
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
20
Fault
Thrown When...
FBPluginException
The plug-in does not send the request or parse the response. A summary
of the error returned from Facebook is displayed in a dialog.
If you get this error with a process that previously worked properly,
Facebook might have added fields to the object that the activity is using.
Check the input field of the activity for missing input, and see Facebook
documentation for details.
FBConnectionException
The HTTP connection to Facebook is not available, or another connection
problem that is unrelated to authorization exists.
FBOauthException
If your token is invalid, your token expires, or you do not have
permissions to retrieve or publish the information you want to retrieve
or publish.
The error message from Facebook is not specific and you have to explore
whether the problem is related to the token or to permissions.
Publish
The Publish activity is used to publish to the Facebook social graph by using HTTP POST requests.
To publish to the Facebook social graph using the HTTP POST requests, you must have an
authentication token. Not all objects are able to be published.
The Post section in the Graph API Facebook Developer Documentation includes details on a post's
fields. The Publish activity includes only a subset of these fields.
General
You can specify what you want to publish in the General tab of the Publish activity.
Field
Module
Property?
Description
Name
No
Name of the Publish activity.
Connections
No
The Connections list contains all potential connections you want to
publish.
Description
In the Description tab, you can enter a short description for the Publish activity.
Input
You can find the following information in the Input tab of the Publish activity.
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
21
Input Item
Data
Type
Description
<first
element>
String
The name and contents of the first element depends on the selection you
make in the General tab. For example, if you choose Comments (of an
Object), specify the ID of the post that you want to publish a comment
to, and the parameters for the comment.
parameters
String
The precise parameters depend on the selection you make in the
General tab. For example, if you select Comments (of an Object),
specify the message of the comment.
token
String
The Facebook authentication token (OAuth token) to access the data.
Output
You can find the following information in the Output tab of the Publish activity.
Output Item
Data
Type
Description
publishResult
String
In General the ID of the published object.
For connection such as Maybe (of an Event), Declined (of an
the Publish activity returns true; otherwise, an error occurs
in the process.
Event),
Fault
You can find the exceptions that are thrown by the Publish activity in the Fault tab.
Fault
Thrown When...
FBPluginException
The plug-in does not send the request or parse the response. A summary
of the error returned from Facebook is displayed in a dialog.
If you get this error with a process that previously worked properly,
Facebook might have added fields to the object that the activity is using.
Check the input field of the activity for missing input, and see Facebook
documentation for details.
FBConnectionException
The HTTP connection to Facebook is not available, or another connection
problem that is unrelated to authorization exists.
FBOauthException
If your token is invalid, your token expires, or you do not have
permissions to retrieve or publish the information you want to retrieve
or publish.
The error message from Facebook is not specific and you have to explore
whether the problem is related to the token or to permissions.
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
22
Delete
The Delete activity is used to delete objects in the social graph by using HTTP DELETE requests, for
example, delete a comment, or a like for an object.
General
You can specify the type of the object in the General tab of the Delete activity.
Field
Module
Property?
Description
Name
No
Name of the Delete activity.
Object
No
Select the type of object you want to delete from the Object list.
Four objects are available: Post, Comment, Link, and Other. If you
select Other, specify other objects by entering the Object ID in the
Input tab. These objects were published by the Publish activity
earlier.
When this manual was written, information about permissions to
delete an object was available at http://developers.facebook.com/
docs/authentication/permissions.
The Delete activity only deletes objects that have an ID. Objects that
do not have an ID, such as Attending (of an Event), and Maybe
(of an Event), are not deleted separately from the object. For
these cases, the whole object, for example, the Links, is deleted if the
permissions are set.
Unlike this
object
No
Select this check box to unlike an object.
Description
In the Description tab, you can enter a short description for the Delete activity.
Input
You can find the following information in the Input tab of the Delete activity.
Input Item
Data
Type
Description
graphObjectID
String
ID of the object to be deleted.
If the graphObjectID is not of the correct Object type, and
the user access token has permission to delete the object to
which the graphObjectID belongs, the plug-in deletes the
object without returning any error.
token
String
The Facebook authentication token (OAuth token) to access the data.
Output
You can find the result in the Output tab of the Delete activity.
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
23
Output Item
Data
Type
Description
deleteResult
Boolean
It is True if successful.
If the Delete operation is not successful, an error occurs.
Fault
The Fault tab lists exceptions that are thrown by the Delete activity.
Fault
Thrown When...
FBPluginException
The plug-in does not send the request or parse the response. A summary
of the error returned from Facebook is displayed in a dialog.
If you get this error with a process that previously worked properly,
Facebook might have added fields to the object that the activity is using.
Check the input field of the activity for missing input, and see Facebook
documentation for details.
FBConnectionException
The HTTP connection to Facebook is not available, or another connection
problem that is unrelated to authorization exists.
FBOauthException
If your token is invalid, your token expires, or you do not have
permissions to retrieve or publish the information you want to retrieve
or publish.
The error message from Facebook is not specific and you have to explore
whether the problem is related to the token or to permissions.
RealTimeListener
The RealTimeListener activity is used to subscribe to data changes in Facebook.
An ActiveMatrix BusinessWorks application improves reliability and decreases load times by listening
to changes rather than polling the Facebook servers.
If there is a valid subscription, when data changes, Facebook servers make an HTTP POST request to
the callback URL that ActiveMatrix BusinessWorks specifies. The request has a content type of
application/json. The body is a JSON-encoded string that contains one or more changes. The output of
the content is in XML by default; however, the JSON format is also available.
1. An internal Jetty server is set up with an HTTP connection URL. The server receives both HTTP
GET requests (for subscription verification) and HTTP POST requests (for actual changed data)
from Facebook.
2. The Jetty server makes a POST to the Facebook graph API URL to subscribe to changes on certain
Facebook objects, and is ready to handle the verification request.
3. Facebook servers make an HTTP GET request to the callback URL.
4. The Jetty server verifies the verify_token value that ActiveMatrix BusinessWorks passes to Facebook
and returns the hub.challenge value. This verification technique prevents malicious apps from
using the real-time feature as tool for distributed denial-of-service (DDoS) attacks.
General
The General tab includes information in the following table.
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
24
Field
Module
Property?
Description
Name
No
Name of the RealTimeListener activity.
HTTP
Connection
Yes
The IP address (or machine name) that you run this listener on, and
port of the listener endpoint.
App ID
Yes
ID of your app.
Access
Token
Yes
The access token associated with the app. It is not the user access
token.
Object Type
No
Object you want to subscribe to. Facebook currently supports to
subscribe to user and page objects.
Fields
Yes
The list of fields and a list of connections in the selected object that
you want to subscribe to.
JSON
Output
No
Select this check box to receive the output in JSON format. The default
value is XML.
Description
In the Description tab, you can enter a short description for the RealTimeListener activity.
Advanced
The Advanced tab includes information in the following table.
Field
Module
Property?
Description
Sequence
Key
No
This field contains an XPath expression that specifies which processes
might run in order. Process instances with sequencing keys that evaluate
to the same value are executed sequentially in the order the process
instances were created.
Custom
Job Id
No
This field contains an XPath expression that specifies a custom ID for the
process instance.
Conversations
In the Conversations tab, you can initiate or join a conversation.
Conversations receive messages after the creation of the process instance, which is initiated or joined by
an activity.
The RealTimeListenter activity is used to initiate a conversation. Click the Add New Conversation
icon to initiate a conversation. For more details on conversations, see TIBCO ActiveMatrix BusinessWorks
Application Design.
Output
The Output tab of the RealTimeListener activity, you can find the output results.
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
25
Output
Item
Data Type
Description
entry
String
List of changed object entries. The entry contains the following items:
1. The first item varies depending on the object type you selected in the
General tab.
●
changed_fields: Fields that are changed for the user object.
●
changes: Changes that are changed for the page object.
2. id: ID of the object that has changed.
3. uid: Object ID of the changed object entry.
4. time: Time at which the change happened.
object
String
Object of the notification.
Fault
The Fault tab lists exceptions that are thrown by the RealTimeListener activity.
Fault
Thrown When...
FBPluginException
The plug-in does not send the request or parse the response. A summary
of the error returned from Facebook is displayed in a dialog.
If you get this error with a process that previously worked properly,
Facebook might have added fields to the object that the activity is using.
Check the input field of the activity for missing input, and see Facebook
documentation for details.
FBConnectionException
The HTTP connection to Facebook is not available, or another connection
problem that is unrelated to authorization exists.
FBOauthException
If your token is invalid, your token expires, or you do not have
permissions to retrieve or publish the information you want to retrieve
or publish.
The error message from Facebook is not specific and you have to explore
whether the problem is related to the token or to permissions.
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
26
Configuring Proxy Settings
If you cannot connect to Facebook because your network does not have a permission to do it, add a
proxy server to enable the connection.
Configuring Inbound Proxy Settings
You can set an inbound proxy for the RealTimeListener activity.
Procedure
1. Open the process for which you want to enable the inbound proxy.
2. From the menu, click Run > Run Configurations.
3. Click BusinessWorks Application > BWApplication in the left panel.
4. Click the Arguments tab in the right panel.
5. In the VM arguments field, add the following parameters:
●
-Dfacebook.realtimelistener.listening.host=proxy_host_IP.
●
-Dfacebook.realtimelistener.listening.port=proxy_port_number.
6. Click Apply.
Configuring Outbound Proxy Settings
You can set an outbound proxy for all the activities.
Procedure
1. Open the process for which you want to enable the outbound proxy.
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
27
2. From the menu, click Run > Run Configurations.
3. Click BusinessWorks Application > BWApplication in the left panel.
4. Click the Arguments tab in the right panel.
5. In the VM arguments field, add the following parameters:
●
-Dcom.tibco.plugin.facebook.http.proxySet=true
●
-Dcom.tibco.plugin.facebook.http.proxyHost=proxy_host_IP
●
-Dcom.tibco.plugin.facebook.http.proxyPort=proxy_port_number
●
-Dcom.tibco.plugin.facebook.http.proxyUser=username
●
-Dcom.tibco.plugin.facebook.http.proxyPassword=password
●
If you want to disable the outbound proxy, delete all the previous parameters, or set
the -Dcom.tibco.plugin.facebook.http.proxySet parameter to false.
●
The username and password parameters are optional when the connection is
anonymous.
●
If the password is encrypted, see Using Encrypted Password.
6. Click Apply.
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
28
If you want to deploy the process, you have to add the following parameters to the
file, which is located in the TIBCO_HOME\bw\version\bin directory:
bwcommon.tra
java.extended.properties=-Dcom.tibco.plugin.facebook.http.proxySet=true
-Dcom.tibco.plugin.facebook.http.proxyHost=proxy_host_IP
-Dcom.tibco.plugin.facebook.http.proxyPort=proxy_port_number
-Dcom.tibco.plugin.facebook.http.proxyUser=username
-Dcom.tibco.plugin.facebook.http.proxyPassword="password"
See TIBCO ActiveMatrix BusinessWorks Administration Guide for more details.
Encrypting a Password
When connecting to an outbound proxy server, you can encrypt a password by using TIBCO®
Enterprise Administrator.
Prerequisites
Before encrypting a password, you have to install TIBCO Enterprise Administrator in your
TIBCO_HOME.
Procedure
1. Open a command line and switch to the following directory:
TIBCO_HOME\tea\agents\tss\version\bin
2. Enter the following command:
obfuscate.exe
3. Type your password and press Enter.
4. Type your password again and press Enter.
After a while, the obfuscated password is displayed.
For more information about TIBCO Enterprise Administrator, see https://docs.tibco.com/products/
tibco-enterprise-administrator-2-2-0.
Using Encrypted Password
You can use an encrypted password to connect to an outbound proxy server.
Procedure
1. Open the process for which you want to enable the outbound proxy.
2. From the menu, click Run > Run Configurations.
3. Click BusinessWorks Application > BWApplication in the left panel.
4. Click the Arguments tab in the right panel.
5. In the VM arguments field, add the following parameters:
●
-Dcom.tibco.plugin.facebook.http.proxySet=true
●
-Dcom.tibco.plugin.facebook.http.proxyHost=proxy_host_IP
●
-Dcom.tibco.plugin.facebook.http.proxyPort=proxy_port_number
●
-Dcom.tibco.plugin.facebook.http.proxyUser=username
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
29
●
-Dcom.tibco.plugin.facebook.http.proxyPassword=
6. Move a cursor to the -Dcom.tibco.plugin.facebook.http.proxyPassword parameter.
7. Click Variables in the VM arguments field.
8. In the Select Variable dialog, click Edit Variable.
9. In the Preferences dialog, click New.
10. In the New String Substitution Variable dialog, enter a variable name in the Name field and enter
the encrypted password in the Value field.
11. Click OK twice.
12. In the variable list, double-click the password variable.
13. Click Apply.
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
30
Working with the Sample Project
Working through the sample project helps you understand how TIBCO ActiveMatrix BusinessWorks
Plug-in for Facebook works.
TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook packages a sample project within the
installer. The sample project is located in the TIBCO_HOME\bw\palettes\facebook\6.0\samples
directory.
In this example, it is assumed that a small family-owned purveyor of hand-crafted garden ornaments
has a number of customers. Each customer is a fan of the store's Facebook page, which helps customers
to keep abreast of new products and other exciting developments. The tutorial uses the term fan for any
user who adds a comment to a page post, likes a post, or adds a post to the company page. The
webmaster uses TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook to obtain customers'
interests and then decide the product direction.
The sample project consists of two processes:
1. The Configurations for ParsingPageFeeds Process collects the user ID of the company's facebook
page fans.
2. The Configurations for ProductDirection Process checks how many company fans are also fans of
the National Weather Service, and compares the two numbers.
Importing the Sample Project
A sample project is packaged with the plug-in. Before running the project, you have to import the
project to TIBCO Business Studio.
Procedure
1. Start TIBCO Business Studio.
2. Click File > Import.
3. In the Import window, expand the General folder and select the Existing Studio Projects into
Workspace item. Click Next.
4. Click Browse next to the Select root directory field to locate the sample. Click Finish.
The sample project is located in the TIBCO_HOME\bw\6.2\palettes\facebook\6.0\samples
directory.
Working with the ParsingPageFeeds-ProductDirection Project
The example collects user IDs of the company's fans, and determines product direction by analyzing
the data.
Prerequisites
●
Ensure that you have imported the sample project, as described in Importing the Sample Project.
●
In this description, it is assumed that you know how to configure TIBCO BusinessWorks processes.
See the TIBCO BusinessWorks documentation for details.
●
To configure this example for your own application, the Page ID for the company page and a
Facebook Authentication Token are required.
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
31
Procedure
1. Expand the sample project in the Project Explorer view.
2. Click Processes > sample > ProductDirection.bwp.
3. Click Run > Run Configurations.
4. Expand BusinessWorks Application in the Run Configurations dialog and click BWApplication.
5. Ensure only the sample.application is selected in the Applications tab.
6. Click Run.
7. Click the Terminate
icon to stop the process.
Result
The ParsingPageFeeds process collects the user IDs of the company's facebook page fans. The list of
User IDs of company fans becomes the input to the ProductDirection process, and the output of the
MergeUIDs activity is passed on to the next activity. The ProductDirection process determines which
company fans are also fans of the National Weather Service, and compares the two numbers. If more
than 50% of the company fans are also passionate about weather, the process gives a green light for
production of the new product, and then the company crafts a small number of weather stations
tastefully framed in Brazilian ironwood, and posts a brief introduction to the product to the company
Facebook page, with a link to the company Web site for more details and photos.
Configurations for the ParsingPageFeeds Process
The ParsingPageFeeds process extracts User IDs of the company's fans from the company feed.
The process is designed with the following activities:
Activity
Description
NewOperationIn
Reads output from the previous activity it connects.
Our Page Feeds
A Graph Query that extracts the company's page feed and passes it to
three Mapper activities.
Get Users who posted
A Mapper activity that is used to extract all users who posted to the
company page.
Get Users who liked
posts
A Mapper activity that is used to extract all users who liked the post of the
company page.
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
32
Activity
Description
Get Users who
commented
A Mapper activity that is used to extract all users who made comment on
the post of the company page.
Merge UIDs
A Java Code MergeUIDs activity that combines the output of the three
Mapper activities, and passes the output to the next process with a list of
all company fans. The code eliminates duplicates.
NewOperationOut
Transfers its value as input for the next activity it connects.
Configurations for the ProductDirection Process
The ProductDirection process is the top-level process. It determines which company fans are also fans
of the National Weather Service, and compares the two numbers. If more than 50% of the company fans
are also passionate about weather, the process gives a green light for production of the new product.
The process is designed with the following activities:
Activity
Description
Timer
Starts the process.
Get our Page Fans
Invokes the ParsingPageFeeds process to extract User IDs of all fans of the
company from the company feed.
Check Fans of other
Page
Iterates over the company fans and checks whether a fan is also interested
in the National Weather Service.
JavaInvoke
Compares company fans and users who are both fans of the company and
the National Weather Service. The activity returns true if more than half
of the company's fans are interested in weather.
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
33
Managing Logs
Logs are used to trace and troubleshoot the plug-in exceptions.
A logback.xml file is located in the TIBCO_HOME\bw\6.2\config\design\logback directory, update
this file to Setting Up Log Levels and Exporting Logs to a File.
Log Levels
The plug-in captures logs at different levels.
Log Level
Description
Error
Indicates that an unrecoverable error has occurred. Depending on the error
severity, the plug-in might continue with the next operation or might stop
altogether.
Debug
Indicates a developer-defined tracing message.
Setting Up Log Levels
By default, the log level is Error . You can change the log level to trace different messages.
If neither the plug-in log nor the BusinessWorks log is configured in the logback.xml file, the error
logs of the plug-in are displayed in the Console view by default.
If the plug-in log is not configured, but the BusinessWorks log is configured in the logback.xml file,
the configuration for the BusinessWorks log is implemented by the plug-in.
Procedure
1. Navigate to the TIBCO_HOME\bw\6.2\config\design\logback directory and open the
logback.xml file.
2. Add the following node in the User Loggers area to specify the log level for the plug-in.
<logger name="com.tibco.bw.palette.facebook.runtime">
<level value="DEBUG"/>
</logger>
The level tag defines the log level and the value is Error or Debug.
When the level is set to Debug, the input and output of the plug-in activities are also
displayed in the Console view. See Log Levels for more details on each log level.
3. Optional: Add the following node in the User Loggers area to specify the log level for an activity.
<logger name="com.tibco.bw.palette.facebook.runtime.ActivityNameActivity">
<level value="DEBUG"/>
</logger>
For example, if you want to set the log level of the Publish activity to Debug, you have to add the
following node:
<logger name="com.tibco.bw.palette.facebook.runtime.PublishActivity">
<level value="DEBUG"/>
</logger>
For activities that do not configure with specific log levels, they still inherit log levels
configured for the plug-in or BusinessWorks.
4. Save the file.
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
34
Exporting Logs to a File
You can export the plug-in logs to a file by modifying the logback.xml file.
Procedure
1. Navigate to the TIBCO_HOME\bw\6.2\config\design\logback directory and open the
logback.xml file.
When deploying an application in TIBCO Enterprise Administrator, you have to navigate
to the TIBCO_HOME\bw\6.2\domains\mydomain\appnodes\myspace\mynode directory to
find the logback.xml file.
2. Add the following node to specify the file location.
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>c:/bw6-facebook.log</file>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36}-%msg%n</pattern>
</encoder>
</appender>
The file tag defines the location to which the log is exported and the value is the absolute path of
the file.
You also have to add the file name in the file path.
3. Add the following node to the root node at the bottom of the logback.xml file to enable exporting
the logs to a file.
<appender-ref ref="FILE" />
<root level="DEBUG">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
</root>
4. Save the file.
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
35
Error Codes
The exceptions that are thrown by the plug-in are listed with corresponding descriptions and
resolutions.
Error Code and Error
Message
Role
Category
Description
Resolution
TIBCO-BW-PALETTEFACEBOOK-200000
debugRol
e
BW-Plug-in
Describes the general
Debug information.
No action.
errorRole
BW-Plug-in
An error occurs when
retrieving XML
Output for activity.
No action.
errorRole
BW-Plug-in
The encoding
provided is not
supported.
Provide UTF-8
encoding.
errorRole
BW-Plug-in
An error occurs in the
network connection.
Check the
network
connection.
errorRole
BW-Plug-in
An error occurs when
executing client
operation.
Check client
operation.
errorRole
BW-Plug-in
An error occurs when
running a process.
No action.
errorRole
BW-Plug-in
Occurs when the
input token is invalid,
expired or with
wrong permission.
Input valid token
with the right
permission.
errorRole
BW-Plug-in
Occurs when
conducting the
Publish activity.
No action.
Info: [1%].
TIBCO-BW-PALETTEFACEBOOK-500000
IOException occurred
while retrieving XML
Output for activity [1%].
TIBCO-BW-PALETTEFACEBOOK-500001
Unsupported encoding
[1%].
TIBCO-BW-PALETTEFACEBOOK-500002
Facebook connection
Error, Error message:
[1%].
TIBCO-BW-PALETTEFACEBOOK-500003
Execute client operation
failed [1%].
TIBCO-BW-PALETTEFACEBOOK-500004
BW Facebook activity
error [1%].
TIBCO-BW-PALETTEFACEBOOK-500005
Please check token [1%].
TIBCO-BW-PALETTEFACEBOOK-500006
Publish activity error:
[1%].
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
36
Error Code and Error
Message
TIBCO-BW-PALETTEFACEBOOK-500007
Role
Category
Description
Resolution
errorRole
BW-Plug-in
The value for the
privacy_type filed in
the Input tab of the
Publish activity is not
right.
Provide the right
value for the
privacy_type
filed.
errorRole
BW-Plug-in
The uploaded photo
does not exist.
Check the
existence of the
file to be
uploaded.
errorRole
BW-Plug-in
Occurs when you
have no permission to
do the corresponding
operation, or the
input token is invalid.
Check the
permission and
input valid token.
errorRole
BW-Plug-in
Occurs when the
format of
maxNumOfPage
value is incorrect.
Input correct
format in the
maxNumOfPage
field.
errorRole
BW-Plug-in
Occurs when
converting objects
into XML by using
JAXB.
No action.
errorRole
BW-Plug-in
Occurs when reparsing XML.
No action.
errorRole
BW-Plug-in
Occurs when parsing
Java objects into XML.
No action.
errorRole
BW-Plug-in
Occurs when parsing
XML.
No action.
The value for input field
privacy_type must be
uppercase and the scope
is{'OPEN','SECRET','FRIE
NDS','CLOSED'}.
TIBCO-BW-PALETTEFACEBOOK-500008
File not found. Please
check your upload photo
exist or not.
TIBCO-BW-PALETTEFACEBOOK-500009
Facebook return false
with no result -- Can not
get result from facebook.
Please check permission.
TIBCO-BW-PALETTEFACEBOOK-500010
Number format
exception in reading
page_parameter: [1%].
TIBCO-BW-PALETTEFACEBOOK-500011
JAXB convertion error for
class: [1%].
TIBCO-BW-PALETTEFACEBOOK-500012
Exception in re-parsing
XML. Error message:
[1%].
TIBCO-BW-PALETTEFACEBOOK-500013
SAX Exception. Error
message: [1%].
TIBCO-BW-PALETTEFACEBOOK-500014
IO Exception in parsing
XML. Error message:
[1%].
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
37
Error Code and Error
Message
TIBCO-BW-PALETTEFACEBOOK-500015
Role
Category
Description
Resolution
errorRole
BW-Plug-in
The value in the
Input tab is invalid.
Check values in
the Input tab.
errorRole
BW-Plug-in
Occurs when
Facebook returns no
search result.
Check the search
permission and
the network
connection.
errorRole
BW-Plug-in
Occurs when
conducting the FQL
Query activity.
No action.
errorRole
BW-Plug-in
Occurs when
conducting the FQL
Query activity.
No action.
errorRole
BW-Plug-in
Occurs when null
schema node is
found.
Check the schema.
errorRole
BW-Plug-in
Occurs when parsing
columns.
No action.
errorRole
BW-Plug-in
Occurs when starting
the Realtime listener
activity.
No action.
errorRole
BW-Plug-in
Occurs when starting
Jetty.
Check network
connection.
errorRole
BW-Plug-in
Occurs when
stopping Jetty.
Check network
connection.
The Invalid Input value.
Error message: [1%].
TIBCO-BW-PALETTEFACEBOOK-500016
Facebook return null.
Please check permission/
connection.
TIBCO-BW-PALETTEFACEBOOK-500017
IO Expection. Error
Message: [1%].
TIBCO-BW-PALETTEFACEBOOK-500018
FQL Expection. Error
Message: [1%].
TIBCO-BW-PALETTEFACEBOOK-500019
Null Schema Node
found!
TIBCO-BW-PALETTEFACEBOOK-500020
Parse error message:
[1%].
TIBCO-BW-PALETTEFACEBOOK-500021
The RealTimeListener
start failed, error
message: [1%].
TIBCO-BW-PALETTEFACEBOOK-500022
The Jetty stop failed,
error message: [1%].
TIBCO-BW-PALETTEFACEBOOK-500023
The Jetty start failed,
error message: [1%].
TIBCO ActiveMatrix BusinessWorks™ Plug-in for Facebook User's Guide
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement