Skip to content

Latest commit

 

History

History
70 lines (48 loc) · 1.46 KB

README.md

File metadata and controls

70 lines (48 loc) · 1.46 KB

Twitter4J-Webhook

Manage the Twitter account activity API. This adds some classes that can be used with Twitter4J to manage webhooks, as well as subscriptions to those webhooks.

Installation

Install with maven

<dependency>
  <groupId>com.abhaybd</groupId>
  <artifactId>twitter4j-webhook</artifactId>
  <version>0.0.1</version>
</dependency>

Usage

Create a webhook manager

Twitter twitter = TwitterFactory.getSingleton();
WebhookManager manager = new WebhookManager(twitter.getConfiguration(), "ENV_NAME");

Register a webhook at the given URI

manager.addWebhook(URI.create("https://example.webhook.com/webhook"));

Unregister the currently registered webhook

manager.removeWebhook();

Get the information for the currently registered webhook

WebhookInfo info = manager.getWebhookInfo();
System.out.println(info.getID());
System.out.println(info.isValid());

Trigger a CRC check for the currently registered webhook

manager.triggerCRC();

Register the currently authenticated user to this webhook

manager.registerCurrentUser();

Unregister all users from this webhook

manager.unregisterAllUsers();

Unregister a specific user from this webhook

long userId = 1024L;
manager.unregisterUser(userId);