Introducing the First Implementation of Periscope Producer API

Periscope Producer API was first announced with this post on twitter blog at March 21, 2017 by defining it as follows

Periscope Producer API which opens up new ways to share live video, such as starting broadcasts directly from external hardware, software, cameras and web services — without the need to connect them via the app. The API enables third-party applications to authenticate Periscope accounts, configure streams, start and stop broadcasts and publish broadcasts to Twitter.

Then lots of tech sites like Variety, VentureBeat, etc. will publish this news on their site. It was also announced on TwitterDev account

Unfourtunately, this APIwas first announced as private beta and developers need to fill the private beta waitlist form to get documentation and some parameters like client id from Periscope Support so we did.

Today, we are honored to share, probably the first, implementation of Periscope Producer API on Github with the approval from Periscope side and now let’s look at how to use this API.

How to use Periscope Producer API

First download and add jar to your class path

Authorize Your App

There are two ways for this.

  • Device Code
  • OAuth2 Authorization Code

We provide source code for Device Code method below, please go to github page to see OAuth2 Authorization Code sample

//create an AuthorizationEndPoint instance
AuthorizationEndpoints authorizationEndpoint = PeriscopeEndpointFactory.getAuthorizationEndpoint();

//make a create device code request
CreateDeviceCodeResponse createDeviceCodeResponse = authorizationEndpoint.createDeviceCode(CLIENT_ID);

//Follow the instructions
System.out.println("Go to this url: " + createDeviceCodeResponse.associate_url);
System.out.println("Enter this user code: " + createDeviceCodeResponse.user_code);
System.out.println("and come back here");

CheckDeviceCodeResponse checkDeviceCode;
do {
System.out.println("Waiting for "
+ createDeviceCodeResponse.interval
+ " seconds to check device code");

//wait for interval seconds to check device code
Thread.sleep(createDeviceCodeResponse.interval * 1000);

//make a check device code to test if user code is
//entered to associated url as mentioned above
checkDeviceCode = authorizationEndpoint.checkDeviceCode(
createDeviceCodeResponse.device_code, CLIENT_ID);

} while(!checkDeviceCode.state.equals("associated"));
// save access and refresh token fields to use in later requests.

Create and Publish Broadcast

Here is the sample code that creates and publishs a broadcast. We provide
in-line comments to help you understand easily

AuthorizationEndpoints authorizationEndpoint = PeriscopeEndpointFactory.getAuthorizationEndpoint();
String code = "code returned by periscope";
String redirect_uri = " redirect uri in your application";

AuthorizationResponse authorizationResponse = authorizationEndpoint.authWithOauth2(
code, redirect_uri, null, CLIENT_ID, CLIENT_SECRET);

Stop Broadcast

Just call BroadcastEndpoints’ stopBroadcast function with the broadcast id that is returned in creating and publishing broadcast


Delete Broadcast

Just call BroadcastEndpoints’ deleteBroadcast function with the broadcast id that is returned in creating and publishing broadcast


Get Broadcast

Just call BroadcastEndpoints’ getBroadcast function with the broadcast id to query the broadcast

Broadcast broadcast = endpoint.getBroadcast(;
assertEquals(broadcast.state, "ended");
assertEquals(broadcast.title, title);

As you see, function calls are so straightforward and we have reached the end. If you have any question about the API, please drop a comment or contact via

Btw, I hope this implementation will help some guys out there and make your task finish faster

mekya —

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade