tibco activematrix businessw orks plug-in for facebook · 2015. 2. 6. · tibco activematrix...

50
TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Upload: others

Post on 27-Aug-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

TIBCO ActiveMatrix BusinessWorksPlug-in for FacebookUser's GuideSoftware Release 1.0May 2012

Page 2: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012
Page 3: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Contents

Important Information............................................................................................5

Preface.....................................................................................................................7Related Documentation............................................................................................................8

Connecting with TIBCO Resources........................................................................................10

Chapter 1 Introduction....................................................................11Plug-In Overview....................................................................................................................12

Activity Overview....................................................................................................................13

Chapter 2 Authentication and Authorization Example.................15Introduction to Facebook Authentication................................................................................16

Preparing Your Example App..................................................................................................17

Generating Extended Authentication Tokens..........................................................................18

Chapter 3 Facebook Palette............................................................19Graph Query Activity..............................................................................................................20

Graph Query Configuration Tab...................................................................................20

Graph Query Input Tab................................................................................................20

Graph Query Output Tab.............................................................................................21

Graph Query Error Output Tab....................................................................................21

Graph Query Example Scenario.................................................................................22

Graph Query Troubleshooting......................................................................................23

Search Activity........................................................................................................................24

Search Configuration Tab............................................................................................24

Search Input Tab..........................................................................................................24

Search Output Tab.......................................................................................................25

Search Error Output Tab..............................................................................................25

Search Example Scenario...........................................................................................25

FQL Query Activity.................................................................................................................27

FQL Query Configuration Tab......................................................................................27

FQL Query Input Tab...................................................................................................28

FQL Query Output Tab................................................................................................28

FQL Query Error Output Tab.......................................................................................28

FQL Query Example Scenario....................................................................................29

Publish Activity.......................................................................................................................30

Publish Configuration Tab............................................................................................30

Publish Input Tab.........................................................................................................31

Publish Output Tab......................................................................................................31

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

TOC | 3

Page 4: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Publish Error Output Tab.............................................................................................31

Publish Example Scenario...........................................................................................32

Delete Activity.........................................................................................................................34

Delete Configuration Tab.............................................................................................34

Delete Input Tab...........................................................................................................35

Delete Output Tab........................................................................................................35

Delete Error Output Tab...............................................................................................35

Delete Activity Troubleshooting....................................................................................36

RealTimeListener Activity.......................................................................................................37

RealTimeListener Configuration Tab...........................................................................37

RealTimeListener Output Tab......................................................................................38

RealTimeListener Error Output Tab.............................................................................38

RealTimeListener Example Scenario..........................................................................39

Chapter 4 Troubleshooting and Errors..........................................41Troubleshooting Overview......................................................................................................42

Troubleshooting Activity Errors...............................................................................................43

Facebook Plug-in Exceptions.................................................................................................44

Chapter 5 Process Example............................................................45Example Overview.................................................................................................................46

Creating the Parsing Page Feeds Process.............................................................................47

Creating the Product Direction Process.................................................................................49

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

4 | TOC

Page 5: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Important Information

SOME TIBCO SOFTWARE EMBEDS OR BUNDLES OTHER TIBCO SOFTWARE. USE OF SUCH EMBEDDEDOR BUNDLED TIBCO SOFTWARE IS SOLELY TO ENABLE THE FUNCTIONALITY (OR PROVIDE LIMITEDADD-ON FUNCTIONALITY) OF THE LICENSED TIBCO SOFTWARE. THE EMBEDDED OR BUNDLEDSOFTWARE IS NOT LICENSED TO BE USED OR ACCESSED BY ANY OTHER TIBCO SOFTWARE ORFOR ANY OTHER PURPOSE.

USE OF TIBCO SOFTWARE AND THIS DOCUMENT IS SUBJECT TO THE TERMS AND CONDITIONSOF A LICENSE AGREEMENT FOUND IN EITHER A SEPARATELY EXECUTED SOFTWARE LICENSEAGREEMENT, OR, IF THERE IS NO SUCH SEPARATE AGREEMENT, THE CLICKWRAP END USERLICENSE AGREEMENT WHICH IS DISPLAYED DURING DOWNLOAD OR INSTALLATION OF THESOFTWARE (AND WHICH IS DUPLICATED IN THE LICENSE FILE) OR IF THERE IS NO SUCH SOFTWARELICENSE AGREEMENT OR CLICKWRAP END USER LICENSE AGREEMENT, THE LICENSE(S) LOCATEDIN THE “LICENSE” FILE(S) OF THE SOFTWARE. USE OF THIS DOCUMENT IS SUBJECT TO THOSETERMS AND CONDITIONS, AND YOUR USE HEREOF SHALL CONSTITUTE ACCEPTANCE OF ANDAN AGREEMENT TO BE BOUND BY THE SAME.

This document contains confidential information that is subject to U.S. and international copyright laws andtreaties. No part of this document may be reproduced in any form without the written authorization of TIBCOSoftware Inc.

TIBCO, The Power of Now, TIBCO ActiveMatrix BusinessWorks, TIBCO Rendezvous, TIBCO Administrator,and TIBCO Enterprise Message Service are either registered trademarks or trademarks of TIBCO SoftwareInc. in the United States and/or other countries.

EJB, Java EE, J2EE, and all Java-based trademarks and logos are trademarks or registered trademarks of SunMicrosystems, Inc. in the U.S. and other countries.

All other product and company names and marks mentioned in this document are the property of theirrespective owners and are mentioned for identification purposes only.

THIS SOFTWARE MAY BE AVAILABLE ON MULTIPLE OPERATING SYSTEMS. HOWEVER, NOT ALLOPERATING SYSTEM PLATFORMS FOR A SPECIFIC SOFTWARE VERSION ARE RELEASED AT THESAME TIME. SEE THE README FILE FOR THE AVAILABILITY OF THIS SOFTWARE VERSION ON ASPECIFIC OPERATING SYSTEM PLATFORM.

THIS DOCUMENT IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS ORIMPLIED, 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 WILLBE INCORPORATED IN NEW EDITIONS OF THIS DOCUMENT. TIBCO SOFTWARE INC. MAY MAKEIMPROVEMENTS AND/OR CHANGES IN THE PRODUCT(S) AND/OR THE PROGRAM(S) DESCRIBEDIN THIS DOCUMENT AT ANY TIME.

THE CONTENTS OF THIS DOCUMENT MAY BE MODIFIED AND/OR QUALIFIED, DIRECTLY ORINDIRECTLY, BY OTHER DOCUMENTATION WHICH ACCOMPANIES THIS SOFTWARE, INCLUDINGBUT NOT LIMITED TO ANY RELEASE NOTES AND "READ ME" FILES.

Copyright (c) 2012 TIBCO Software Inc. ALL RIGHTS RESERVED.

TIBCO Software Inc. Confidential Information

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

Page 6: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012
Page 7: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Preface

The TIBCO ActiveMatrix BusinessWorks™ integration platform enables companies to rapidly integratesystems and automate business processes. The TIBCO BusinessWorks Plug-in for Facebook allows ActiveMatrixBusinessWorks customers to navigate, query, and interact with the Facebook social graph without any codingby using the activities in the Facebook palette.

Related TopicsRelated Documentation on page 8Connecting with TIBCO Resources on page 10

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

Page 8: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Related Documentation

This section lists documentation resources you may find useful.

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook Documentation

The following documents form the TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook documentationset.• TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook Installation. Read this manual for instructions on

site preparation and installation.• TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook User's Guide. Read this manual for information on

how to use the product.• TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook Release Notes. Read the release notes for a list features.

This document also contains lists of known issues and closed issues for this release.

TIBCO ActiveMatrix BusinessWorks Documentation

TIBCO ActiveMatrix BusinessWorks is a prerequisite for the TIBCO ActiveMatrix BusinessWorks Plug-infor Facebook. The TIBCO ActiveMatrix BusinessWork documentation set includes the following documents.• TIBCO ActiveMatrix BusinessWorks Concepts. Read this manual before reading any other manual in the

documentation set. This manual describes terminology and concepts of TIBCO ActiveMatrix BusinessWorks,and the other manuals in the documentation set assume you are familiar with the information in thismanual.

• TIBCO ActiveMatrix BusinessWorks Getting Started. Steps you through a very simple example of designing,deploying, and monitoring a ActiveMatrix BusinessWorks process.

• ActiveMatrix BusinessWorks Process Design Guide. Describes how to create, edit, and test business processesusing TIBCO ActiveMatrix BusinessWorks.

• ActiveMatrix BusinessWorks Palette Reference Describes each of the palettes available in TIBCO ActiveMatrixBusinessWorks.

• TIBCO ActiveMatrix BusinessWorks Administration. Describes how to use TIBCO Administrator to deploy,manage, and monitor TIBCO ActiveMatrix BusinessWorks processes.

• TIBCO ActiveMatrix BusinessWorks Installation. Read this manual for information on installing one or morecomponents of ActiveMatrix BusinessWorks and setting up a ActiveMatrix BusinessWorks domain.

• TIBCO ActiveMatrix BusinessWorks Error Codes. Describes errors returned by TIBCO ActiveMatrixBusinessWorks.

• TIBCO ActiveMatrix BusinessWorks Release Notes. Read the release notes for a list of new and changedfeatures. This document also contains lists of known issues and closed issues for this release.

Other TIBCO Products

The following products are tightly integrated with TIBCO ActiveMatrix BusinessWorks and with the Plug-infor Facebook.• TIBCO Designer™ software. An easy to use graphical user interface for design-time configuration of

TIBCO applications. TIBCO Designer includes online help for each palette.• TIBCO Administrator™ software. TIBCO Administrator is the monitoring and managing interface for

new-generation TIBCO products such as TIBCO ActiveMatrix BusinessWorks.• TIBCO Adapter software

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

8 | Preface

Page 9: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Third-Party Documentation

Facebook developer documentation discusses the Facebook social graph in detail, describes the authenticationand authorization process, and explains how Facebook permissions work. For up-to-date information onthose topics and other topics relevant to using the plugin, go to the Facebook Developer Documentation.

Related TopicsPreface on page 7

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

Preface | 9

Page 10: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Connecting with TIBCO Resources

How to Join TIBCOmmunity

TiBCOmmunity is an online destination for TIBCO customers, partners, and resident experts. It is a place toshare and access the collective experience of the TIBCO community. TIBCOmmunity offers forums, blogs,and access to a variety of resources. To register, go to http://www.tibcommunity.com.

How to Access TIBCO Documentation

After you join TIBCOmmunity, you can access the documentation here: http://docs.tibco.com.

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 username and password. If you do not have a username, you can request one.

Related TopicsPreface on page 7

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

10 | Preface

Page 11: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Chapter

1Introduction

Before you start using the activities in the TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook palette, youneed an overview of the plug-in and of the different activities.

Topics

• Plug-In Overview• Activity Overview

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

Page 12: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Plug-In Overview

TIBCO ActiveMatrix BusinessWorks is a scalable, extensible, and easy to use integration platform that allowsyou to develop integration projects. TIBCO ActiveMatrix BusinessWorks uses the TIBCO Designer graphicaluser interface (GUI) for defining business processes and the TIBCO ActiveMatrix BusinessWorks processengine executes the business processes. For a detailed discussion, see TIBCO ActiveMatrix BusinessWorksConcepts.

ActiveMatrix BusinessWorks supports plug-ins. When you install a plug-in, activities for the plug-in becomeavailable in the TIBCO Designer interface. You can add the plug-in activities to the business process you aredesigning, and integrate them with the process flow. At runtime, the plug-in activities are executed as partof the ActiveMatrix BusinessWorks process execution.

The 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 APIof the platform, in this case, the Facebook Graph API, any open issues that have been reported against thethird-party API result in problems with the plug-in. If Facebook makes changes to their public API, theactivities functionality might become limited or might change.

Because the information about the activities is easy to extract from the Facebook Developer documentation,this manual's focus is on an overview of each activity's tab. The manual also includes a typical examplescenario for each activity. For example, the Graph Query example scenario queries the feed for a user youspecify.

Related TopicsIntroduction on page 11

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

12 | Introduction

Page 13: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Activity Overview

When you start working with the plug-in, you might initially have some questions about the activities.

Search, Graph Query, and FQL Query Activities

The Search, Graph Query, and FQL Query activities allow you to mine the Facebook social graph for data.You can direct each of the activities to other TIBCO ActiveMatrix BusinessWorks activities to filter theinformation you retrieve.

On the Input tab of each of the three activities includes the following fields.pageSize

Number of iterms included in each retrieval. Default is 1.

maxNumOfPages

Number of retrieval operations each time the process is run. Default is 1.

For example, if you set maxNumOfPages to 2 and page_Size to 3, the system retrieves six items. If you setmaxNumOfPages to 1 and page_Size to 4, the system retrieves four items.

You use the different data retrieval activities in different situations.Search

Allows you to perform a simple search over the whole Facebook user space. You cannot restrict thesearch parameters, though you could filter the output with another BusinessWorks activity.

Graph Query

Allows you to query an object and associated connections, for example, a user's friends or a user's post.You must specify the object ID for the object you want to retrieve information about.

FQL Query

Allows you to perform a database query using Facebook Query Language. You can specify a user namewhen you use FQL, but you do not need the user ID.

Publish and Delete Activities

Publish and Delete activities add objects or remove objects. These activities modify the space of the user orother object. The app that is associated with the TIBCO BusinessWorks ActiveMatrix Plug-in for Facebookmust have permission to perform the activities.

As a rule, the user associated with the app and the app itself must be friends of a user to publish to a user'spage or to remove items from a user's page. The app can only remove items that it published earlier.

A further restriction is that the TIBCO BusinessWorks ActiveMatrix plug-in can delete only objects that theplug-in posted. Even if the user associated with the plug-in app made a change using the Facebook UI, theplug-in cannot undo that change.

Related TopicsIntroduction on page 11

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

Introduction | 13

Page 14: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012
Page 15: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Chapter

2Authentication and Authorization Example

The Facebook Platform uses the OAuth 2.0 protocol for authentication and authorization. The protocol itself andhow Facebook uses the protocol can change at any time. This document therefore provides only an example.

Topics

• Introduction to Facebook Authentication• Preparing Your Example App• Generating Extended Authentication Tokens

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

Page 16: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Introduction to Facebook Authentication

Each activity in the plug-in includes a token field in the Input tab. You must include an authentication tokenin 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 Facebookuser name and password.

App authorization

Ensures that when your app asks a user for access, the user knows exactly what data and capabilitiesthey are providing to your application.

Most ActiveMatrix BusinessWorks Plug-in for Facebook applications do not ask users for access butwork with publicly available user data instead.

App authentication

Ensures that users can be sure they are giving data to your app and not to a different app.

After your app completes these steps, the app is issued an access token that allows the app to access the user'sinformation if it has appropriate permissions. For example, you app might be able to examine the posts of auser and of all friends of the user.

For background information on Facebook Authentication, go to the Core Concepts section of theFacebook Developer documentation and select Authenticating an App in the sidebar. Do not click oneof the authentication flow links on the first page.

Related TopicsAuthentication and Authorization Example on page 15

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

16 | Authentication and Authorization Example

Page 17: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Preparing Your Example App

Before you begin

You can run some Facebook examples without authentication tokens, and you can generate a token for verylimited use with just one user. However, if you want to follow this example to generate a token for longeruse, you should make sure you have two Facebook users that are friends.App_admin

A user who logs in to create or run the app.

App_user

A user who represents the company that runs the application. This user friends other users, therebygaining access to the data of the company's friends.

It is possible to have one user act as App_admin and App_user, but a clean separation between the applicationcreator and the company representative is useful.

About this task

For this example, you have to create an app and set up appropriate permissions for the App_admin andApp_user users.

This example illustrates one way of using authentication tokens. How you set up your environmentdepends on what you want to do and on what Facebook supports.

Procedure

1. Log in as App_admin and create an app with the privacy settings you want to use. See the FacebookDeveloper documentation, especially the tutorial.Facebook generates an App ID and an App Secret and makes it available to App_admin through a redirectURL, which looks like the following.https://www.facebook.com/dialog/oauth &client_id=app_id&redirect_uri=https://www.facebook.com/connect/login_success.html &response_type=token&scope=read_stream,email,user_birthday,user_events,user_groups,user_checkins,friends_groups,friends_checkins,friends_events,publish_stream

2. While logged in as App_admin, send a friend request to App_user to get access to the data of the friendsof App_user.

3. Log in as App_user and accept the friend request.When App_user accepts the friend request, Facebook sends an access token for App_user to App_admin.By accepting the request, App_user makes all data and all visible data of friend's of App_user availableto the app.You can use the access token ID in the token field of the different activities' Input tab.

ResultsThe app now has access to all friends of the activity for the amount of time that Facebook uses as the default.When this manual was written, the default was approximately 2 hours.

Related TopicsAuthentication and Authorization Example on page 15

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

Authentication and Authorization Example | 17

Page 18: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Generating Extended Authentication Tokens

Before you begin

Before you start generating extended authentication tokens, create users and prepare your app. See PreparingYour Example App on page 17.

About this task

By default, a Facebook authentication token expires after two hours. You can extend the token to be valid forsix days.

The precise expirations for tokens and extended tokens depend entirely on the settings Facebookassigns to those tokens.

Procedure

1. Log in as the App_user user and select App Settings > Advanced.2. Enable Deprecate offline access and save your settings.3. In a Web browser, access the Facebook page for App_admin and go to the privacy page settings

http://www.facebook.com/about/privacy/your_info.4. Log in as App_user, select Apps and Settings, and remove the app.5. Log out, clear your browser's cache, and use the following redirect URL for getting the initial token. The

URL cannot contain spaces, line breaks below are added for legibility.https://www.facebook.com/dialog/oauth &client_id=app_id&redirect_uri=https://www.facebook.com/connect/login_success.html &response_type=token&scope=read_stream,email,user_birthday,user_events,user_groups,user_checkins,friends_groups,friends_checkins,friends_events,publish_stream

6. Use the token that is returned for a short time (less than two hours).7. Go to a different machine, start a Web browser, and log in to Facebook as App_user.

You will now exchange the short-term token for a long-term token. The extension request requires thatyou have a currently valid token.

8. Use that extension URL with the existing token, App ID, App Secret, and so on to extend the token. TheURL cannot contain spaces, line breaks below are added for legibility.https://graph.facebook.com/oauth/access_token ?client_id=app_id&client_secret=app_secret&grant_type=fb_exchange_token&fb_exchange_token=token

Related TopicsAuthentication and Authorization Example on page 15

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

18 | Authentication and Authorization Example

Page 19: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Chapter

3Facebook Palette

The Facebook Palette contains the activities you can include in your business process.

Topics

• Graph Query Activity• Search Activity• FQL Query Activity• Publish Activity• Delete Activity• RealTimeListener Activity

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

Page 20: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Graph Query Activity

The Facebook social graph represents the connections between Facebook objects such as users, links, andpages. You can use the Graph Query Activity to query the social graph and then publish the results for furtheruse.

Graph Query allows you to search for a specific object and its details. It does not return results across allFacebook objects like Search but focuses on a single object. A Graph Query searches a much smaller spacethan a Search activity, but it requires the Object ID for the object you want information about.

Related TopicsFacebook Palette on page 19Graph Query Configuration Tab on page 20Graph Query Input Tab on page 20Graph Query Output Tab on page 21Graph Query Error Output Tab on page 21Graph Query Example Scenario on page 22Graph Query Troubleshooting on page 23

Graph Query Configuration Tab

The Graph Query Configuration tab lets you specify the name and description of your query, select an objectto query, and specify the connections of the object that you are interested in.

DescriptionField or Property

Name of the query.Name

Query description.Description

One of the Facebook objects to query on.Object

Click this checkbox to query connections between objects. A CollectionNamedrop-down appears.

Query Connection

Type of connection you can query. For example, if you select a Post object, thisdrop-down allows you to select Comments, Insights, and Likes.

See the Facebook Developer documentation for details.

CollectionName

Related TopicsGraph Query Activity on page 20

Graph Query Input Tab

DescriptionField or Property

Run the process twice to retrieve information, with different valuesin the Input tab. .

graphObjectID

1. Use your own user ID or the string "me", including the doublequotes to retrieve the object you want to query. For example,you might want to query a friend's connections, and you needthat friend's user ID to do so.

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

20 | Facebook Palette

Page 21: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

DescriptionField or Property

2. In a second Graph Query activity, specify the ID of the objectthat you actually want to retrieve information about.

Maximum number of fetch operations the process performs.Default is 1.

If you specify -1, the plug-in fetches data until the end of the resultset Facebook returns, regardless of the page size limit.

maxNumOfPages

Number of items returned for each fetch operation. Default is 1.

If you specify -1 for maxNumOfPages, this value is ignored.

page_Size

Additional parameters, depending on the selection you made inthe Configuration tab.

additionalParams

Facebook authentication token (OAuth token) to access the datatoken

Related TopicsGraph Query Activity on page 20

Graph Query Output Tab

XML representation of the returned object. The information available in the object depends on the object thatis selected in the Configuration tab and on the permissions settings for that object. For example, if you selectthe object Link and the CollectionName Comments to get all comments on a link, the following fields areincluded in the output.

• id• metadata• type• from• message• createdTime• likes

Related TopicsGraph Query Activity on page 20

Graph Query Error Output Tab

DescriptionError

If the plug-in cannot send the request or parse the response, anFBPluginException results. A summary of the error returned from Facebookdisplays in a dialog.

Select Window > Show Console to see the complete error message.

FBPluginException

If you get this error with a process that previously worked properly, Facebookmight have added fields to the object the activity is using. Check the inputfield of the activity for missing input and see the Facebook documentationfor details.

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

Facebook Palette | 21

Page 22: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

DescriptionError

If the HTTP connection to Facebook is not available, or if another connectionproblem that is unrelated to authorization exists, an FBConnectionExceptionresults.

FBConnectionException

If your token is invalid, your token expired, or you do not have permissionsto retrieve or publish the information you want to retrieve or publish, anFBOauthException results.

The error message from Facebook is not specific and you might have toexplore whether the problem is related to the token or related to permissions.

FBOauthException

Related TopicsGraph Query Activity on page 20

Graph Query Example Scenario

Before you begin

• You need a Facebook Authentication Token. See Authentication and Authorization Example on page 15.• You need the User ID of a Facebook user. A common approach is to first run a query with the user "me",

and to retrieve that user's friends. In a second pass, user IDs of friends can be passed in and the informationcan be retrieved when you set the Graph Query CollectionName to Friends to collect the names of theuser's friends.

About this taskThe precise setup of the Configuration tab and the Input tab for an activity depends on the supported objectsin the Facebook API and in the plug-in. The example scenario queries the feed for a user you specify.

This example scenario illustrates only one way of using the activity.

Procedure

1. In TIBCO Designer, create a process select the Facebook palette, and add the Graph Query activity to theprocess.

2. Connect the Start activity to Graph Query and Graph Query to the End activity.3. Select the Graph Query activity and make the following choices in the Configuration tab.

– Name - Graph Query 42– Object - User– QueryConnection - Checked– CollectionName - Feed

You check the QueryConnection checkbox to select connections associated with the selected object.

4. (Optional) Select the Input tab, select $_globalVariables, and enter the following values in the ActivityInput pane.

– GraphObjectID - Enter the User token for the user you want to query.– token - Enter the Facebook authentication token this process should use.

You can specify the ID and the token in the mapper instead.

5. Run the process.6. Select the Output tab and click Source.

You can review or process the feed data for the user you specified.

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

22 | Facebook Palette

Page 23: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Related TopicsGraph Query Activity on page 20

Graph Query Troubleshooting

At times, your Graph Query might return different results than you expect. Review this information to helpresolve your problem.

• When you use a Graph Query to query a user's connection, you specify the ID in the Input tab. If youspecify the User ID instead of the Connection ID, Facebook queries the User, and the results correspondto the object. Check carefully in the input tab of any activity, that you use the correct ID. The User ID andthe Connection ID are different, though no error results if you use the User ID in place of a ConnectionID.

• While working with a Graph Query, some confusion might result with a user's Subscribers and Subscribedtoconnections.– USER_ID/Subscribers - This user connection returns the people who are subscribed to given USER_ID.

According to Facebook documentation all friends are users' subscribers, but when you try to accessthis connection it returns only the actual subscribers, not friends.

– USER_ID/Subscribedto - This user connection returns the list of users to whom the given USER_IDis subscribed. According to Facebook documentation USER_ID is subscribed to all his friends, butwhen you try to access this connection it returns only the user to whom USER_ID is explicitly subscribedto, not all friends of the user.

Facebook documentation does not discuss this behavior, but all Facebook tools and APIs (Graph API,SOAP_UI, etc.) return the same result as the plug-in.

• When you access user information with Graph Query, you can only access basic information. You cannotaccess information on the user's interests such as books, movies, and so on. Consider using an FQL Queryinstead.

• When you query for the links of a user, the query returns only the links of the user, not links of otherusers.

• When you set up a Graph Query activity to retrieve all Likes for a Link on a user's page, no error resultseven if you specify a User ID in the Input tab because Facebook cannot distinguish between User ID andLink ID. When you run the process, it returns the Likes for the User.

To resolve the issue, change the graphObjectID on the Input tab to be a Link ID.

Related TopicsGraph Query Activity on page 20

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

Facebook Palette | 23

Page 24: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Search Activity

The Search activity allows you to search public objects in the social graph. Searchable objects include publicposts, people, pages, events, groups, places, and checkins. By default, Search returns one result.

Add quotes around strings that include special characters.

You might also need to add a set of single quotes if the string you want to search for already includes doublequotes, or if text is repeating in the string. For example, to search for "fun fun fun" , enter the text '"fun funfun"'.

Related TopicsFacebook Palette on page 19Search Configuration Tab on page 24Search Input Tab on page 24Search Output Tab on page 25Search Error Output Tab on page 25Search Example Scenario on page 25

Search Configuration Tab

DescriptionField or Property

Name of the searchName

Query searchDescription

The Facebook objects to search on.Object Type

Related TopicsSearch Activity on page 24

Search Input Tab

DescriptionField or Property

Text to search Facebook for.searchText

Maximum number of fetch operations the process performs.Default is 1.

If you specify -1, the plug-in fetches data until the end of the resultset Facebook returns, regardless of the page size limit.

maxNumOfPages

Number of items returned for each fetch operation. Default is 1.

If you specify -1 for maxNumOfPages, this value is ignored.

pageSize

Additional parameters, depending on the object you select in theConfiguration tab.

additionalParams

The token field only appears if you selected Place or User in theConfiguration tab. For other selections, you are performing a searchover public data and no token is required.

token

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

24 | Facebook Palette

Page 25: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Related TopicsSearch Activity on page 24

Search Output Tab

XML representation of the returned object. The information available in the object depends on the object thatis selected in the Configuration tab and on the permissions settings for that object.

Related TopicsSearch Activity on page 24

Search Error Output Tab

DescriptionError

If the plug-in cannot send the request or parse the response, anFBPluginException results. A summary of the error returned from Facebookdisplays in a dialog.

Select Window > Show Console to see the complete error message.

FBPluginException

If you get this error with a process that previously worked properly, Facebookmight have added fields to the object the activity is using. Check the inputfield of the activity for missing input and see the Facebook documentationfor details.

If the HTTP connection to Facebook is not available, or if another connectionproblem that is unrelated to authorization exists, an FBConnectionExceptionresults.

FBConnectionException

If your token is invalid, your token expired, or you do not have permissionsto retrieve or publish the information you want to retrieve or publish, anFBOauthException results.

The error message from Facebook is not specific and you might have toexplore whether the problem is related to the token or related to permissions.

FBOauthException

Related TopicsSearch Activity on page 24

Search Example Scenario

Before you begin

You need a Facebook Authentication Token. See Authentication and Authorization Example on page 15.

About this taskThe precise setup of the Configuration tab and the Input tab for an activity depends on the supported objectsin the Facebook API and in the plug-in.For this example, you need an access token for a User object and Placeobject. Other objects do not require additional access tokens.

This example scenario illustrates only one way of using the activity.

Procedure

1. In TIBCO Designer, create a process, select the Facebook palette, and add a Search activity to the process.

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

Facebook Palette | 25

Page 26: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

2. Connect the Start activity to Search and Search to the End activity.3. Select the Search activity and make the following choices in the Configuration tab.

– Name: Search 55– Object Type: Post

Setting these values allows you to search for posts. that contain the search text you specify in the Inputtab.

4. Select the Input tab, and enter the following values in the Activity Input pane.

– search_text - Type in the search text, for example, "Two-Second Advantage". Double quotes arerequired.

5. Run the process.6. Select the Output tab and click Source.

The Source pane displays the posts on Facebook that include the string.

Related TopicsSearch Activity on page 24

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

26 | Facebook Palette

Page 27: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

FQL Query Activity

Facebook Query Language, or FQL, allows you to query the data available in the Facebook social graph. Incontrast to the Graph Query activity and the Search activity, you can narrow down the search results.

What is displayed in the output depends on the permissions associated with the token.

FQL queries use the following syntax:

SELECT [fields] FROM [table] WHERE[conditions]

Unlike SQL, the FQL FROM clause can contain only a single table. You can define subqueries by using INkeyword in the SELECT clause or in the WHERE clauses. However, subqueries cannot reference variablesin the outer query's scope.

Your query can include basic boolean operators ( AND or NOT logical operators) and ORDER BY and LIMITclauses. Your query must be indexable, which means that it queries properties that are marked as indexablein the Facebook Graph API documentation.

Some of the advanced functionality available in the FQL API is not supported by the Facebook FQL Quereyactivity. For example, if you want to perform multiple queries, you have to feed the result of one FQL Queryinto a second FQL Query.

For some queries, you need not only the authentication token but also the application token. See theFacebook documentation for details.

Related TopicsFacebook Palette on page 19FQL Query Configuration Tab on page 27FQL Query Input Tab on page 28FQL Query Output Tab on page 28FQL Query Error Output Tab on page 28FQL Query Example Scenario on page 29

FQL Query Configuration Tab

The Configuration tab allows you to define the query by following these steps:1. Define the FROM clause by selecting one of the items in the Tables dropdown.2. Define the SELECT clause by selecting one or more of the columns that become available when you click

Pick Columns.3. Define the WHERE clause, using the syntax discussed in the Facebook developer documentation. You

can define subqueries by using the IN keyword in the WHERE clause. However, subqueries cannotreference variables in the outer query's scope.

DescriptionField or Property

Name of the FQL QueryName

FQL Query description.Description

List of tables over which you can run the FQL Query. See the Facebook DeveloperDocumentation for details on what each table means.

For example, Comment queries this table to obtain comments associated with oneFacebook object, for example, comments associated with a Post, Link, Video, or Photo.

Tables

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

Facebook Palette | 27

Page 28: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

DescriptionField or Property

Click Pick Columns to display a multi-choice table, click the check boxes next to thefields to select, and click OK.

Columns

WHERE clause for the FQL Query.Where

Related TopicsFQL Query Activity on page 27

FQL Query Input Tab

DescriptionField or Property

Optional field to override the WHERE clause of the FQL Query atruntime.

Use this field if a BusinessWorks activity feeds data to this activity,and you want to use something in the input data as the querystring.

whereClause

Specify only the WHERE clause. If the syntax of the text inthis field does not match the WHERE clause syntax, anerror results.

Facebook OAuth token to access the datatoken

Related TopicsFQL Query Activity on page 27

FQL Query Output Tab

XML representation of the returned object. The information available in the object depends on the object thatis selected in the Configuration tab and on the permissions associated with the token. The token permissionsultimately depend on the permissions the user associated with the token granted to the App.

The plug-in supports a subset of the output returned by the Facebook FQL Query API. If the FacebookQuery API changes, even those fields might not all be available.

Related TopicsFQL Query Activity on page 27

FQL Query Error Output Tab

DescriptionError

If the plug-in cannot send the request or parse the response, anFBPluginException results. A summary of the error returned from Facebookdisplays in a dialog.

Select Window > Show Console to see the complete error message.

FBPluginException

If you get this error with a process that previously worked properly, Facebookmight have added fields to the object the activity is using. Check the inputfield of the activity for missing input and see the Facebook documentationfor details.

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

28 | Facebook Palette

Page 29: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

DescriptionError

If the HTTP connection to Facebook is not available, or if another connectionproblem that is unrelated to authorization exists, an FBConnectionExceptionresults.

FBConnectionException

If your token is invalid, your token expired, or you do not have permissionsto retrieve or publish the information you want to retrieve or publish, anFBOauthException results.

The error message from Facebook is not specific and you might have toexplore whether the problem is related to the token or related to permissions.

FBOauthException

Related TopicsFQL Query Activity on page 27

FQL Query Example Scenario

Before you begin• You need a Facebook Authentication Token. See Authentication and Authorization Example on page 15.• Decide on an indexable column field with a corresponding value to perform the query over.

About this taskThe precise setup of the Configuration tab and the Input tab for an activity depends on the supported objectsin the Facebook API and in the plug-in. This example scenario illustrates only one way of using the activity.

This example scenario illustrates only one way of using the activity.

Procedure

1. In TIBCO Designer, create a process, select the Facebook palette, and add an FQL Query activity to theprocess.

2. Connect the Start activity to FQL Query and FQL Query to the End activity.3. Select the FQL Query activity and select or type the following in the Configuration tab.

– Name - FQL Query 58– Tables - user– Columns -

uid,first_name,middle_name,last_name,pic,religion,movies,about_me,notes_count,email,third_party_id

– where - uid=me()

4. Select FQL Query in the Process Pane to display the Column Editor and verify the fields you typed in theColumns field are selected.You can change the fields to query from the Columns editor.

5. Run the process.6. Select the Output tab and click Source.

The <Output> element displays the requested information. What can be displayed depends on the tokenassociated with the App.

7. Click Source to display the XML version of the output.

Related TopicsFQL Query Activity on page 27

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

Facebook Palette | 29

Page 30: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Publish Activity

Your ActiveMatrix BusinessWorks Plug-in for Facebook process can publish to the Facebook social graph byusing HTTP POST requests. You must have an authentication token. You cannot publish to all objects.

The Post section in the Graph API Facebook Developer documentation includes details on a post'sfields. The Publish activity includes only a subset of these fields.

Examples

For example, to publish an event, follow these steps:1. In the Configuration tab, select Events (of a User) and click Apply.2. If you want to invite someone to your event, create another Publish activity and select Invited (of an Event)

in the Configuration tab.3. The invited user can then publish Attending (of an Event), Maybe (of an Event) and Declined (of an Event).

Another good example is publishing notes.

Facebook Documentation

The Facebook documentation includes information about the post's connection. When this manual waswritten, the most relevant information was at https://developers.facebook.com/docs/reference/api/post/.Consult also the section on publishing at http://developers.facebook.com/docs/reference/api.

The Graph API documentation for each Facebook object includes a Connection section that includes a Createsection. This section explains how to publish comments or like that object.

Setting the Privacy Field for the Feed of a User

If you want to set the privacy field for the Feed of a User, you can use a JSON string, for example:"{'value':'CUSTOM', 'friends':'ALL_FRIENDS', 'description':'US,CA'}"

Related TopicsFacebook Palette on page 19Publish Configuration Tab on page 30Publish Input Tab on page 31Publish Output Tab on page 31Publish Error Output Tab on page 31Publish Example Scenario on page 32

Publish Configuration Tab

The Publish configuration tab lets you specify what you want to publish. For example, you might publishesan event to a user's page.

DescriptionField or Property

Name of the Publish activity.Name

Publish activity description.Description

Drop-down list of potential connections you might publish.

When you use the Publish activity to publish the Links (of a Page), you must pass ina page token. Passing in a user token results in an error.

Connection

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

30 | Facebook Palette

Page 31: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Related TopicsPublish Activity on page 30

Publish Input Tab

DescriptionField or Property

The name and contents of the first element of the Input tab dependson the selection you make in the Configuration tab. For example,

<first element>

if you choose Comments (of a Post), you can specify the ID of thepost you want to publish a comment to, and the parameters youcan specify for the comment.

The precise parameters you can specify depend on the selectionyou make in the Configuration tab. For example, if you chooseComments (of a Post), you can specify the message of the comment.

parameters

Facebook OAuth token to access the datatoken

Related TopicsPublish Activity on page 30

Publish Output Tab

DescriptionField or Property

Typically the ID of the published object.

For Attending, Maybe, Declined, Invited and Likes connections,the Publish activity returns true or false instead of an ID.

publishResult

Related TopicsPublish Activity on page 30

Publish Error Output Tab

DescriptionError

If the plug-in cannot send the request or parse the response, anFBPluginException results. A summary of the error returned from Facebookdisplays in a dialog.

Select Window > Show Console to see the complete error message.

FBPluginException

If you get this error with a process that previously worked properly, Facebookmight have added fields to the object the activity is using. Check the inputfield of the activity for missing input and see the Facebook documentationfor details.

If the HTTP connection to Facebook is not available, or if another connectionproblem that is unrelated to authorization exists, an FBConnectionExceptionresults.

FBConnectionException

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

Facebook Palette | 31

Page 32: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

DescriptionError

If your token is invalid, your token expired, or you do not have permissionsto retrieve or publish the information you want to retrieve or publish, anFBOauthException results.

The error message from Facebook is not specific and you might have toexplore whether the problem is related to the token or related to permissions.

FBOauthException

Related TopicsPublish Activity on page 30

Publish Example Scenario

Before you begin

You need a Facebook Authentication Token. See Authentication and Authorization Example on page 15.

About this taskThe precise setup of the Configuration tab and the Input tab for an activity depends on the supported objectsin the Facebook API and in the plug-in. This example scenario illustrates only one way of using the activity.

The example scenario publishes an event to a user's page. After the process has run, you can see in the Outputtab that an event was published, but you cannot see any information about the event. You could insert aSleep activity, and follow that with an FQL Query or a Graph Query to check that the event is visible on thepages to which it was published.

This example scenario illustrates only one way of using the activity.

Procedure

1. In TIBCO Designer, create a process, select the Facebook palette, and add a Publish activity to the process.2. Connect the Start activity to Publish and Publish to the End activity.3. Select the Publish activity and make the following choices in the Configuration tab.

– Name - Publish 42– Connection - Events (of a User)

4. Select the Input tab specify activity input for which you have predefined global variables.

– Profile ID - In the ProcessData pane, open $_globalVariables, open GlobalVariables, and connect fromthe User ID you set up earlier to the profileID in the Activity Input pane.

You can get that ID by performing a Graph Query for a User Object's Friends.

– Token - Connect from the user's Authentication token in the Process Data pane to the token field inthe Activity Input pane.

5. Open parameters and specify event parameters as shown in the following example screen.

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

32 | Facebook Palette

Page 33: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

6. Run the process.7. Select the Output tab and verify that the Output tab indicates that the event was published.8. To independently verify that the event was published, navigate to the Facebook home page and log in as

the user that was used in this Publish activity. Look at the user's events to verify the event is visible.

Related TopicsPublish Activity on page 30

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

Facebook Palette | 33

Page 34: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Delete Activity

The delete activity allows you to delete objects in the social graph. For example, you might be able to deletea comment or delete a like for a post.

The plug-in can only delete items that the plug-in added, and can only perform the deletion if theuser's permissions allow it.

Related TopicsFacebook Palette on page 19Delete Configuration Tab on page 34Delete Input Tab on page 35Delete Output Tab on page 35Delete Error Output Tab on page 35Delete Activity Troubleshooting on page 36

Delete Configuration Tab

The Delete activity Configuration tab includes the following objects:• Link• Post• Page• Event• Other• Comment

If you select Other, you can specify other objects by specifying the Object ID in the Input tab. Those objectsinclude groups, notes, photos, or other objects that the plug-in App published earlier. The Connectiondrop-down menu of the Publish tab shows all objects the plug-in App can publish. You can only specifyobjects that are not included in the Delete Configuration tab when you choose Other.

DescriptionField or Property

Name of the Delete activity.Name

Delete activity description.Description

Select the type of object you want to delete from the drop-down menu. When thismanual was written, information about permissions you might need to delete an objectwas available at http://developers.facebook.com/docs/authentication/permissions.

The Delete activity can only delete objects that have an ID. Objects that do not havean ID, such as Attending, Invited, and Maybe, cannot be deleted separately from the

Object

object. For those cases, the whole object, for example the event, is deleted if thepermissions are set to allow this.

If you selected Post as the object, you can delete the like of the post.Unlike this object

Related TopicsDelete Activity on page 34

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

34 | Facebook Palette

Page 35: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Delete Input Tab

DescriptionField or Property

ID of the object to be deleted, for example, a post ID.graphObjectID

If you accidentally specify the User ID, the user with thatID is deleted.

Facebook OAuth token to access the datatoken

Related TopicsDelete Activity on page 34

Delete Output Tab

DescriptionField or Property

True if successful.

If the Delete operation is not successful, an error results.

deleteResult

Related TopicsDelete Activity on page 34

Delete Error Output Tab

DescriptionError

If the plug-in cannot send the request or parse the response, anFBPluginException results. A summary of the error returned from Facebookdisplays in a dialog.

Select Window > Show Console to see the complete error message.

FBPluginException

If you get this error with a process that previously worked properly, Facebookmight have added fields to the object the activity is using. Check the inputfield of the activity for missing input and see the Facebook documentationfor details.

If the HTTP connection to Facebook is not available, or if another connectionproblem that is unrelated to authorization exists, an FBConnectionExceptionresults.

FBConnectionException

If your token is invalid, your token expired, or you do not have permissionsto retrieve or publish the information you want to retrieve or publish, anFBOauthException results.

The error message from Facebook is not specific and you might have toexplore whether the problem is related to the token or related to permissions.

FBOauthException

Related TopicsDelete Activity on page 34

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

Facebook Palette | 35

Page 36: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Delete Activity Troubleshooting

At times, your Delete activity might behave differently than you expect. Review this information to helpresolve your problem.• When you attempt to use the Delete activity to delete posts from a user's profile, an Invalid Parameter

Error results. The behavior is based on a difference between a user's links and a user's feeds and thecorresponding access tokens.– USER_ID/links - Returns the links created by the mentioned USER_ID. The link is same as post with

additional attribute link. To access all the links (public, private) of the user we need his access tokenwith "read_stream" permission, otherwise only the links that are public will be displayed.

– USER_ID/feed - Return anything that was posted on given USER_IDs wall. This includes updatesfrom given USER_ID and his friends. The updates include status, posts, and links from given USER_IDand his friends. To access all the feeds we need "read_stream" permission on the user or else we'll onlyget public feeds.

• When you use the Publish activity to publish the Links or Checkins of a User, Facebook returns a 1-partID for that user. When the Delete activity attempts to delete that Link or Checkin, the Delete operationfails because Facebook expects a 2-part ID.

This issue has been reported as http://bugs.developers.facebook.net/show_bug.cgi?id=10413.

• Even though the Delete activity includes a Page option, you cannot delete a page. The Publish activitydoes not support publishing a page, and your App cannot delete items it did not publish.

Related TopicsDelete Activity on page 34

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

36 | Facebook Palette

Page 37: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

RealTimeListener Activity

The RealTimeListener activity is a TIBCO ActiveMatrix BusinessWorks starter activity. It enables ActiveMatrixBusinessWorks customers to subscribe to changes in data in Facebook. By listening to changes, rather thanpolling the Facebook servers, an ActiveMatrix BusinessWorks application can improve reliability and decreaseload times.

Internally, the listener starter activity follows these steps to set up a subscription:1. An internal Tomcat server is set up with an endpoint URL. The server receives both HTTP GET requests

(for subscription verification) and HTTP POST requests (for actual changed data) from Facebook.2. The Tomcat 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 will make an HTTP GET request to the callback URL.4. The Tomcat 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 thereal-time feature as tool for distributed denial-of-service (DDoS) attacks.

5. If there is a valid subscription, and if data changes, Facebook servers make an HTTP POST request to thecallback URL ActiveMatrix BusinessWorks specified. The request has a content type of application/json.The body is a JSON-encoded string that contains one or more changes. By default, ActiveMatrixBusinessWorks outputs the content in XML. You can instead output the content in JSON.

Related TopicsFacebook Palette on page 19RealTimeListener Configuration Tab on page 37RealTimeListener Output Tab on page 38RealTimeListener Error Output Tab on page 38RealTimeListener Example Scenario on page 39

RealTimeListener Configuration Tab

DescriptionField or Property

Name of the RealTimeListener activity.Name

RealTimeListener activity description.Description

The IP address (or machine name) that you run this listener on.Endpoint Address

Port of the listener endpointPort

ID of your app.App ID

The access token associated with the app. This is not the user access token.Access Token

Object you want to subscribe to. Facebook currently allows you to subscribe to user,permission, and page objects.

Object type

The list of fields and a list of connections in the selected object that you want tosubscribe to.

Fields

Click this check box to receive the output in JSON format. The default is text.JSON

Click this checkbox to set up the connection as an SSL connection.SSL

Keystore file location. Visible only if you turned on SSL.Keystore File

Password of the keystore file. Visible only if you turned on SSL.Keystore Password

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

Facebook Palette | 37

Page 38: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Related TopicsRealTimeListener Activity on page 37

RealTimeListener Output Tab

The change notification sent from Facebook does not include the actual data values; to obtain those, you canrequest them as normal, subject to the usual privacy restrictions.

If you select the JSON Object field in the Configuration tab, the output is a JSON object. If you do not selectthe JSAN Object field in the Configuration tab, the output is XML.

DescriptionField or Property

Object this notification is for.object

List of changed object entries.entry

Object ID of the change object entry.uid

Fields that are changed for the changed object entry.changed_fields

Time at which the change happened.time

Related TopicsRealTimeListener Activity on page 37

RealTimeListener Error Output Tab

DescriptionError

If the plug-in cannot send the request or parse the response, anFBPluginException results. A summary of the error returned from Facebookdisplays in a dialog.

Select Window > Show Console to see the complete error message.

FBPluginException

If you get this error with a process that previously worked properly, Facebookmight have added fields to the object the activity is using. Check the inputfield of the activity for missing input and see the Facebook documentationfor details.

If the HTTP connection to Facebook is not available, or if another connectionproblem that is unrelated to authorization exists, an FBConnectionExceptionresults.

FBConnectionException

If your token is invalid, your token expired, or you do not have permissionsto retrieve or publish the information you want to retrieve or publish, anFBOauthException results.

The error message from Facebook is not specific and you might have toexplore whether the problem is related to the token or related to permissions.

FBOauthException

Related TopicsRealTimeListener Activity on page 37

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

38 | Facebook Palette

Page 39: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

RealTimeListener Example Scenario

Before you begin

• You need a Facebook Authentication Token. See Authentication and Authorization Example on page 15.• You need the User ID of a Facebook user. A common approach is to first run a query with the user "me",

and to retrieve that user's friends. In a second pass, user IDs of friends can be passed in and the informationcan be retrieved.

About this taskThe precise setup of the Configuration tab and the Input tab for an activity depends on the supported objectsin the Facebook API and in the plug-in. This example scenario illustrates only one way of using the activity.

The example scenario implements a real-time listener that checks for changes to the feed and the friends ofa user you specify.

This example scenario illustrates only one way of using the activity.

Procedure

1. In TIBCO Designer, create a process and drag the RealTimeListener activity on top of the Design pane.RealTimeListener replaces the Start activity.

2. Select the RealTimeListener activity and make the following choices in the Configuration tab.

– Name - RealTimeListener 37– Endpoint Address - Specify an address such as bwsm-test.company37.com– App ID - Paste in the ID for the App that is making the connection to Facebook.– Access Token - Paste in the Access Token associated with the App that is making the connection to

Facebook.– Object Type - User– Fields - Click Pick Fields and specify the connections for the specified user, for example, feed and

friends.

You check the QueryConnection checkbox to select connections associated with the selected object.

3. Run the process and select the Output tab of the RealTimeListener.4. Change a field in any user who granted permission to the App. The feed gets updates from every user

who granted permission.If you are not logged in as a user who can make a change, you might have to log in and log out again.

5. Return to TIBCO Designer and select the RealTimeListener Output tab.The changed field shows feed, and the time field shows the time at which the feed was last changed.

Related TopicsRealTimeListener Activity on page 37

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

Facebook Palette | 39

Page 40: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012
Page 41: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Chapter

4Troubleshooting and Errors

If you encounter problems when you run a process, you can often resolve the problem by looking at the console,the error output, and the error code documentation.

Topics

• Troubleshooting Overview• Troubleshooting Activity Errors• Facebook Plug-in Exceptions

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

Page 42: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Troubleshooting Overview

When your TIBCO ActiveMatrix BusinessWorks process encounters an error, it highlights the activity wherethe error occurred in red and displays an error in a dialog. Several causes for the error are possible.

BusinessWorks process error

If there is a problems with your BusinessWorks process setup, the error displays in a dialog. ChooseWindow > Show Console to display detailed error information.

Select the Output tab in the activity to see the error output. If the message code starts with BW, you canlook up the code in the TIBCO ActiveMatrix BusinessWorks Error Code documentation.

Facebook Plug-in Error Output

If there is a problem with the plug-in configuration, the error displays in the dialog. Choose Window> Show Console to display detailed error information.

To resolve the error, try the suggestions in Facebook Plug-in Exceptions on page 44. Contact TIBCOSupport after you have verified that the error is not the result of a change on the Facebook side.

Related TopicsTroubleshooting and Errors on page 41

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

42 | Troubleshooting and Errors

Page 43: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Troubleshooting Activity Errors

When your run a process and an error results, or when you run a process and the result is not what youexpected, several reasons are possible.• Facebook behavior has changed since the plug-in was released. Read the Facebook API documentation

carefully.• The behavior you expect does not completely map to the behavior of the Facebook API. For example,

certain terms such as "link" might mean something very specific.• In some situations, you can give an input in the Input tab that does not match the item selected in the

Configuration tab.

See the Troubleshooting sections of individual activities and the Release Notes, as well as Facebook developerdocumentation for additional troubleshooting pointers.

Related TopicsTroubleshooting and Errors on page 41

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

Troubleshooting and Errors | 43

Page 44: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Facebook Plug-in Exceptions

If running a process results in an error, the activity where the error occurred is highlighted in red. When youselect the activity's Error Output tab, the Error displays, along with any error that Facebook sent to the plug-in.

DescriptionError

If the plug-in cannot send the request or parse the response, anFBPluginException results. A summary of the error returned from Facebookdisplays in a dialog.

Select Window > Show Console to see the complete error message.

FBPluginException

If you get this error with a process that previously worked properly, Facebookmight have added fields to the object the activity is using. Check the inputfield of the activity for missing input and see the Facebook documentationfor details.

If the HTTP connection to Facebook is not available, or if another connectionproblem that is unrelated to authorization exists, an FBConnectionExceptionresults.

FBConnectionException

If your token is invalid, your token expired, or you do not have permissionsto retrieve or publish the information you want to retrieve or publish, anFBOauthException results.

The error message from Facebook is not specific and you might have toexplore whether the problem is related to the token or related to permissions.

FBOauthException

Related TopicsTroubleshooting and Errors on page 41

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

44 | Troubleshooting and Errors

Page 45: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Chapter

5Process Example

A simple example can help you get started setting up your own processes with the TIBCO ActiveMatrixBusinessWorks Plug-in for Facebook. The example assumes you understand how to set up and run TIBCOBusinessWorks processes from TIBCO Designer.

Topics

• Example Overview• Creating the Parsing Page Feeds Process• Creating the Product Direction Process

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

Page 46: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Example Overview

The example assumes that a small family-owned purveyor of hand-crafted garden ornaments has a selectnumber of customers. Each customer is a fan of the store's Facebook page, which helps customers keep abreastof new products and other exciting developments. The tutorial uses the term fan for any user who added acomment to a page post, liked a post, or added a post to the company page.

To help determine product direction, the webmaster can use the TIBCO ActiveMatrix BusinessWorks Plug-Infor Facebook to determine the interests of the customers. For example, the plug-in is set up to collect the userIDs of the company's fans. If more than 50% of the company's fans are also fans of the National WeatherService, the company crafts a small number of weather stations tastefully framed in Brazilian ironwood, andposts a brief introduction to the product to the company Facebook page, with a link to the company Web sitefor more details and photos.

The example consists of two processes.

ParsingPageFeeds Process

The ParsingPageFeeds process collects the user ID of the fans of the company's facebook page. The processincludes the following activities.1. A Graph Query extracts the company's page feed and passes it to three Mapper activities.2. Three Mapper activities take extract three types of users who are interested in the company from the page

feed. For example, the Get Users who Posted activity extracts all users who posted to the company page.3. A Java Code MergeUIDs activity combines the output of the three Mapper activities, with a list of all

company fans passed on to the next process. The code eliminates duplicates.

ProductDirection Process

The ProductDirection process is the top-level process. It determines which of the company fans are also fansof the National Weather Service, and compares the two numbers. If more than 50% of the company fans arealso passionate about weather, the process gives a green light for production of the new product. The processincludes the following activities.1. The ParsingPageFeeds process extracts the User IDs of all fans of the company from the company feed.2. The Check Fans of Other Page activity iterates over the company fans and checks for each fan whether

the user is also interested in the National Weather Service.3. The CompareFanCounts activity compares counts the company fans and the users who are both fans of

the company and fans of the National Weather Service. The activity true if more than half of the company'sfans are interested in weather.

Facebook authentication tokens are required for each process.

Related TopicsProcess Example on page 45

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

46 | Process Example

Page 47: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Creating the Parsing Page Feeds Process

Before you begin

• This description assumes that you know how to configure TIBCO BusinessWorks processes. See the TIBCOBusinessWorks documentation for details.

• To configure this example for your own application, you need the Page ID for the company page and aFacebook Authentication Token.

About this task

The Parsing Page Feeds Process extracts User IDs of the company's fans from the company feed. This exampleassumes a user is a fan if that user posted to the company page, liked a post on the company page, orcommented on a company page post. You can review the example included in the product, or create theprocess as follows.

Procedure

1. Open TIBCO Designer and select New Empty Project when prompted.2. In the panel on the left, click the Palettes tab and click Process.3. Drag a process into the Design panel on the right and define the process.

– Name - ParsingPageFeeds– targetNamespace - Filled in by Designer

4. Double-Click the process.A Start and End activity appear in the Design panel.

5. Click the Facebook palette, drag a GraphQuery activity to the right of the Start activity in the Design panel,and set up the GraphQuery.a) Select the Connector icon in the menu bar and drag a line from the Start activity to the GraphQuery

activity.b) Click the GraphQuery activity. In the Configuration tab, name the activity Our Page and make the

following selections.• Object - Page• QueryConnection - Checked• CollectionName - Feed

c) In the Input tab, open the ProcessData on the left and the ActivityInput on the right and direct the dataflow.• Copy the company's Page ID into the graphObjectID field.• Copy your authentication token into the token field.

6. Select the General Activity palette, drag three Mapper activities into the Process, and connect and configurethose activities.a) Drag a line from the GraphQuery activity to the first Mapper activity.b) Repeat for the other two Mapper activities.c) Configure each activity to extract one type of user from the company feed.See the TIBCO BusinessWorks documentation for information about Mapper activities, or look at theexample.

7. Select the Java pallet, drag a Java Code activity into the Design panel, and make connections from theMapper activities to the Java Code activity, as shown in the screen shot below.

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

Process Example | 47

Page 48: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

8. In the Java Code, loop through the user IDs the Mapper activities have as their output and make sure noduplicates are included. The list of User IDs of company fans becomes the input to the Product Directionprocess.

9. Modify the Input tab of the End activity so the output of the MergeUIDs activity is passed on to the nextactivity.See the TIBCO BusinessWorks documentation for details.

Figure 1: ParsingPageFeeds Process

Related TopicsProcess Example on page 45

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

48 | Process Example

Page 49: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Creating the Product Direction Process

About this task

The Product Direction process first runs the ParsePageFeeds process, which returns all fans of the company.The process looks at each user and checks whether that user is also a fan of the National Weather Servicepage. Finally, ProductDirection determines the percentage of weather aficionado among the company fansand gives the green light for the new product if more than 50% are interested in the weather.

Procedure

1. Open TIBCO Designer and select New Empty Project.2. In the panel on the left, click the Palettes tab and click Process.3. Drag a process into the Design panel on the right and define the process.

– Name - ProductDirection– targetNamespace - Filled in by Designer

4. Double-Click the process.A Start and End activity appear in the Design panel.

5. From the Project tab, drag the ParsingPageFeeds process into the Design panel and connect it with theStart activity.

6. Click the Facebook palette, and drag an FQL Query activity to the right of the process and make thefollowing selections.a) Configuration tab:

• Name - Check Fans of other Page• Tables - remove check_in, add page_fan• Colums - uid, page_id

b) Input tab:• Create three global variables, access_token, Page_ID and otherPage_ID and spacify the value for

each. If you are using the sample project, replace the values of the existing global variables.• Spedify a Where clause that checks for a user whether that user is a fan of the National Weather

Service, identified by otherPage_ID.concat(concat(concat("uid =", $uids/uids)," and page_id="), $_globalVariables/ns:GlobalVariables/otherPage_ID)

See the TIBCO ActiveMatrix BusinessWorks documentation for more information.

7. Make a group, as follows:a) Select the arrow icon in the toolbar and drag a square around the FQl Query (Check Fans of Other

Page).b) Click the Group icon in the tool bar to create a group and allow for processing of each result.c) Connect the process with the FQL Query groupSee the TIBCO BusinessWorks documentation for information about Group activities, or look at theexample.

8. Select the Java pallet and drag a Java Code activity into the Design panel. This activity collects the outputof Check Fans of other Page and compares is with the total number of company fanse. The activity returnstrue if at least 50% of the company page fans are also fans of the National Weather Service.

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

Process Example | 49

Page 50: TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook · 2015. 2. 6. · TIBCO ActiveMatrix BusinessW orks Plug-in for Facebook User's Guide Software Release 1.0 May 2012

Figure 2: ProductDirection Process

Related TopicsProcess Example on page 45

TIBCO ActiveMatrix BusinessWorks Plug-in for Facebook

50 | Process Example