Do I need to be an affiliate to create a poll

I am creating a game in unreal, and I would like to create a poll in the chat, and based on the result, certain events in the game would change but, when I try to create a poll I get the following error:

LogTemp: Display: {“error”:“Forbidden”,“status”:403,“message”:“Error.PermissionDenied: ownedBy 132111686 is not a partner or affiliate”}

I assume this is because I am not a affiliate is that correct?. Is there another way to test if my implementation works?

void ATwitchChatManager::SendCreatePollRequest() {
	FHttpRequestRef request = FHttpModule::Get().CreateRequest();
	request->OnProcessRequestComplete().BindUObject(this, &ATwitchChatManager::HandleCreatePollResponse);

	UE_LOG(LogTemp, Warning, TEXT("Setting URL"));
	request->SetURL(baseURL + "helix/polls");
	request->SetHeader("Authorization", "Bearer " + pollOAUTHToken);
	request->AppendToHeader("Client-Id", clientID);
	request->AppendToHeader("Content-Type", "application/json");

	TSharedRef<FJsonObject> requestOBJ = MakeShared<FJsonObject>();
	requestOBJ->SetStringField("broadcaster_id", broadcasterID);
	requestOBJ->SetStringField("title", "Did the poll work?");

	TArray< TSharedPtr<FJsonValue> > choises;

	TSharedRef<FJsonObject> choiseOBJ = MakeShareable(new FJsonObject);
	choiseOBJ->SetStringField("title", "yes");

	TSharedRef<FJsonObject> choiseOBJ2 = MakeShareable(new FJsonObject);
	choiseOBJ2->SetStringField("title", "ofcourse");

	choises.Add(MakeShareable(new FJsonValueObject(choiseOBJ)));
	choises.Add(MakeShareable(new FJsonValueObject(choiseOBJ2)));

	UE_LOG(LogTemp, Warning, TEXT("Sending %ld choices"), choises.Num());
	requestOBJ->SetArrayField("choices", choises);

	requestOBJ->SetStringField("duration", "120");

	FString requestBody;
	TSharedRef<TJsonWriter<>> writer = TJsonWriterFactory<>::Create(&requestBody);
	FJsonSerializer::Serialize(requestOBJ, writer);


	UE_LOG(LogTemp, Warning, TEXT("Starting processing"));

Polls are exclusive to Partner/Affiliate channels.

Try the mock API in the Twitch CLI

and/or find a friendly affiliate+ to borrow a token from

This topic was automatically closed after 30 days. New replies are no longer allowed.