private ManagedSourcesApi() throws InterruptedException {
DataSiftConfig config = new DataSiftConfig("username", "api-key");
final DataSiftClient datasift = new DataSiftClient(config);
FacebookPage source = new FacebookPage(config);
String fbToken = "long-lived-facebook-api-token";
source.addOAutToken(fbToken, "name", 1381406400);
//username or id is valid
source.addPage("theguardian", "https://www.facebook.com/theguardian", "a name for this");
//or use the ID of the facebook page
//source.addPage("10513336322", "https://www.facebook.com/theguardian", "a name for this");
//enable options using
source.enableComments(true)
.enableLikes(true)
.enablePostsByOthers(true);
//or all at once
source.setParams(true, true, true);
ManagedSource managedSource = datasift.managedSource().create("My managed source", source).sync();
if (managedSource.isSuccessful()) {
//and now we can do filtering on this page e.g.
Stream stream = datasift
.compile(String.format("interaction.content contains \"news\" AND source.id == \"%s\"",