# New Twitch API - Problems with subscription no POST responses?, no ability to change title?

**URL:** <https://discuss.dev.twitch.com/t/new-twitch-api-problems-with-subscription-no-post-responses-no-ability-to-change-title/18382>\
**Category:** API\
**Created:** [October 24, 2018, 7:29am UTC](https://discuss.dev.twitch.com/t/new-twitch-api-problems-with-subscription-no-post-responses-no-ability-to-change-title/18382 "2018-10-24T07:29:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![spstarr](https://avatars.discourse-cdn.com/v4/letter/s/ad7895/32.png) [@spstarr](https://discuss.dev.twitch.com/u/spstarr)\
**Post date:** [October 24, 2018, 7:29am UTC](https://discuss.dev.twitch.com/t/new-twitch-api-problems-with-subscription-no-post-responses-no-ability-to-change-title/18382/1 "2018-10-24T07:29:16Z")

</div>

So, I’m about to write a small chatbot written in python, so far, I can get the my user ID, create a subscription to **/helix/channels** and I get a 202.

I have a flask server running to handle the callback, I see the **hub.challenge** and return this (as 200 status).

Example code to subscribe to event the client side:

> def subscribe\_to\_twitch\_event():  
> headers = {‘Authorization’: ‘Bearer {0}’.format(get\_twitch\_api\_token()[‘access\_token’])  
> param\_data = {  
> ‘hub.mode’: ‘subscribe’,  
> #‘hub.topic’: ‘[https://api.twitch.tv/helix/users/follows?first=1&to\_id={0}'.format('XXXXX](https://api.twitch.tv/helix/users/follows?first=1&to_id=%7B0%7D'.format('XXXXX)’),  
> ‘hub.topic’: ‘[https://api.twitch.tv/helix/streams?user\_id={0}'.format('XXXXX](https://api.twitch.tv/helix/streams?user_id=%7B0%7D'.format('XXXXX)’),  
> ‘hub.callback’: ‘[http://my-endpoint-server.net/1.0/foobar/twitch/callback](http://my-endpoint-server.net/1.0/foobar/twitch/callback)’,  
> ‘hub.lease\_seconds’: ‘90’,  
> ‘hub.secret’: ‘SECRET SHHH’,  
> }  
> response = requests.post(“[https://api.twitch.tv/helix/webhooks/hub](https://api.twitch.tv/helix/webhooks/hub)”, params=param\_data, headers=headers, verify=True)

> def get\_twitch\_subscriptions():  
> headers = {‘Authorization’: ‘Bearer {0}’.format(get\_twitch\_api\_token()[‘access\_token’])}
> 
> ```
> response = requests.get("https://api.twitch.tv/helix/webhooks/subscriptions", headers=headers, verify=True)
> print response.json()
> 
> ```

I see:

From the initial subscription: \<Response [202]\>

From the check of subscription: {u’pagination’: {}, u’total’: 1, u’data’: [{u’topic’: u’[https://api.twitch.tv/helix/streams?user\_id=XXXXX](https://api.twitch.tv/helix/streams?user_id=XXXXX)’, u’callback’: u’[http://my-endpoint-server.net/1.0/foobar/twitch/callback](http://my-endpoint-server.net/1.0/foobar/twitch/callback)’, u’expires\_at’: u’2018-10-24T07:27:03Z’}]}

Looks good

On the Callback side twitch is sending:

34.217.244.123 - - [24/Oct/2018 03:25:50] “GET /1.0/foobar/twitch/callback?hub.challenge=-MVIY\_JIdhwLhG4icinviIMWz8gsG3pRogqIDmjg&hub.lease\_seconds=90&hub.mode=subscribe&hub.topic=https%3A%2F%[2Fapi.twitch.tv](http://2Fapi.twitch.tv)%2Fhelix%2Fstreams%3Fuser\_id%3DXXXXXXXX HTTP/1.1” 200 -

In the GET for **/1.0/foobar/twitch/callback** I return the hub.challenge value the API returns 200 for http status.

When I go online, change title of stream with Streamlabs OBS, I am not getting callbacks to the POST for **/1.0/foobar/twitch/callback**. Doesn’t seem to be telling me there’s a response coming back.

> @app.route(‘/1.0/foobar/twitch/callback’, methods=[‘GET’, ‘POST’])  
> def \_twitch\_callback():  
> if request.method == ‘GET’:  
> challenge = request.args.get(‘hub.challenge’)  
> print(“Challenge is: {0}”.format(challenge))  
> return challenge  
> else:  
> print(“GOT A POST CALL!!!”)

Whats wrong?

I also don’t see any API method to let me change the stream channel title, or any way to get the stream/channel ID to change the title with the Helix API or this isn’t implemented yet?

Thanks,  
Shawn.

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [October 24, 2018, 2:29pm UTC](https://discuss.dev.twitch.com/t/new-twitch-api-problems-with-subscription-no-post-responses-no-ability-to-change-title/18382/2 "2018-10-24T14:29:25Z")

</div>

> [@spstarr](#):
>
> I also don’t see any API method to let me change the stream channel title

Thats not currently in helix

> [@spstarr](#):
>
> or any way to get the stream/channel ID

As per

> **[Reference](https://dev.twitch.tv/docs/api/reference/#get-users)**
>
> Twitch Developer tools and services to integrate Twitch into your development or create interactive experience on twitch.tv.

You can get a user by username/login or ID, which’ll return both keys

> [@spstarr](#):
>
> ‘hub.lease\_seconds’: ‘90’,

You set the webhook like time to 90 seconds.

Your hook is expiring before you go live/change your title.

You ca set a maximum of 10 days. Try setting it to something longer than 90 seconds.

---

<div class="post-metadata">

**Author:** ![spstarr](https://avatars.discourse-cdn.com/v4/letter/s/ad7895/32.png) [@spstarr](https://discuss.dev.twitch.com/u/spstarr)\
**Post date:** [October 24, 2018, 2:55pm UTC](https://discuss.dev.twitch.com/t/new-twitch-api-problems-with-subscription-no-post-responses-no-ability-to-change-title/18382/3 "2018-10-24T14:55:18Z")

</div>

I’ll try a longer lease, but the code looks right to you?

I’ll have to use the v5 API then for things not implemented though, I wonder if the deadline for December might be pushed further back.

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [October 24, 2018, 3:34pm UTC](https://discuss.dev.twitch.com/t/new-twitch-api-problems-with-subscription-no-post-responses-no-ability-to-change-title/18382/4 "2018-10-24T15:34:31Z")

</div>

> [@spstarr](#):
>
> I wonder if the deadline for December might be pushed further back.

It already has been. Theres no longer an official end date for v5.

> [@spstarr](#):
>
> I’ll try a longer lease, but the code looks right to you?

Yup, as your Challenge is working for you so should be all good for receiving notifications.

---

<div class="post-metadata">

**Author:** ![system](https://d2opxh93rbxzdn.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://discuss.dev.twitch.com/u/system)\
**Post date:** [November 23, 2018, 3:34pm UTC](https://discuss.dev.twitch.com/t/new-twitch-api-problems-with-subscription-no-post-responses-no-ability-to-change-title/18382/5 "2018-11-23T15:34:31Z")

</div>

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