# Twitch webhook subscription gets created successfully but not receiving updates

**URL:** <https://staging-discuss.dev.twitch.com/t/twitch-webhook-subscription-gets-created-successfully-but-not-receiving-updates/27276>\
**Category:** API\
**Created:** [July 22, 2020, 6:13pm UTC](https://staging-discuss.dev.twitch.com/t/twitch-webhook-subscription-gets-created-successfully-but-not-receiving-updates/27276 "2020-07-22T18:13:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abebe\_Biru](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/abebe_biru/32/9742_2.png) [@Abebe\_Biru](https://staging-discuss.dev.twitch.com/u/Abebe_Biru)\
**Post date:** [July 22, 2020, 6:13pm UTC](https://staging-discuss.dev.twitch.com/t/twitch-webhook-subscription-gets-created-successfully-but-not-receiving-updates/27276/1 "2020-07-22T18:13:29Z")

</div>

I am able to receive challenge call and return 200 status code with plain text.

I don’t see any notifications and calling [https://api.twitch.tv/helix/webhooks/subscriptions](https://api.twitch.tv/helix/webhooks/subscriptions)  
returns empty  
{  
“total”: 0,  
“data”: [],  
“pagination”: {}  
}

topic url: [https://api.twitch.tv/helix/streams?user\_id={0}](https://api.twitch.tv/helix/streams?user_id=%7B0%7D)

Here is my controller code dotnet core code hosted in azure. I can hit both get & post endpoint from internet. What am I missing ?

```
[Route("/notice/twitch")]
[Produces("application/json")]
[ApiController]
public class TwitchNotificationsController : ControllerBase
{
    private const string V1 = "v1";
    private const string ChallengeKey = "hub.challenge";

    private readonly ILogger logger;
    private readonly IVideoGameStreamsNoticeManager noticeManage;
  
    public TwitchNotificationsController(IVideoGameStreamsNoticeManager noticeManager, ILogger logger = null)
    {
        noticeManager.ThrowIfNull(nameof(noticeManager));
        this.noticeManage = noticeManager;
        this.logger = logger ?? NullLogger.Instance;
    }

    [HttpPost("{streamerId}")]
    public async Task<IActionResult> ProcessStreamsChangeNoticeAsync(string streamerId, CancellationToken cancellationToken)
    {
        var eventName = $"{nameof(TwitchNotificationsController)}.ProcessStreamsChangeNotice";
        var telemetryContext = new EventContext(Guid.NewGuid());

        return await this.logger.LogTelemetryAsync(eventName, telemetryContext, async () =>
        {
            TwitchStreamEvent twitchStreams = null;
            telemetryContext.AddContext(nameof(streamerId), streamerId);
            IActionResult result = null;
            try
            {
                telemetryContext.AddContext(nameof(twitchStreams), twitchStreams);
                if (twitchStreams == null)
                {
                    result = this.BadRequest(twitchStreams);
                }
                else
                {
                    var headerSignature = this.Request.Headers["X-Hub-Signature"].FirstOrDefault();
                    if (!this.noticeManage.IsAuthorized(headerSignature, twitchStreams.ToJson()))
                    {
                        result = this.BadRequest(twitchStreams);
                    }
                    else
                    {
                        var stream = new VideoGameStream()
                        {
                            StreamerId = streamerId,
                        };

                        if (twitchStreams?.Data?.Any() == true)
                        {
                            var firstStreams = twitchStreams.Data[0];
                            stream.Id = firstStreams.Id;
                            stream.StreamerId = firstStreams.UserName;
                            stream.StreamerMetadataId = firstStreams.UserId;
                            stream.CurrentViewers = firstStreams.ViewerCount;
                            stream.Title = firstStreams.Title;
                            stream.ProviderVideoGameId = firstStreams.GameId;
                            stream.Language = firstStreams.Language;
                            stream.ImageUrl = firstStreams.ThumbnailUrl;
                            stream.StartTime = firstStreams.StartedAt;
                            stream.Type = firstStreams.Type;
                            stream.Status = StreamStatus.Live;
                        }
                        else if (twitchStreams?.Data?.Any() == false)
                        {
                            stream.Status = StreamStatus.Offline;
                        }

                        await this.noticeManage.EnqueueVideoGameStreamAsync(stream, cancellationToken);
                        result = this.Ok();
                    }
                }
            }
            catch (Exception exc)
            {
                // We should return okay also when is there internal server, but track it in our telemetry.
                telemetryContext.AddError(exc);
                result = this.Ok();
            }

            return result;
        });
    }

    [HttpGet("{streamerId}")]
    public Task<string> ReturnChallengeTokenAsync(string streamerId, CancellationToken cancellationToken)
    {
        var eventName = $"{nameof(TwitchNotificationsController)}.ReturnTwitchChallengeToken";
        var telemetryContext = new EventContext(Guid.NewGuid());
        return this.logger.LogTelemetryAsync(eventName, telemetryContext, async () =>
        {
            telemetryContext.AddContext(nameof(streamerId), streamerId);
            this.Request.ThrowIfNull(nameof(this.Request));

            string token = this.Request.Query["hub.challenge"];
            telemetryContext.AddContext(nameof(token), token);

            return token;
        });
    }
}
```

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://staging-discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [July 22, 2020, 6:26pm UTC](https://staging-discuss.dev.twitch.com/t/twitch-webhook-subscription-gets-created-successfully-but-not-receiving-updates/27276/2 "2020-07-22T18:26:26Z")

</div>

Whats your “create subscription” request look like?

---

<div class="post-metadata">

**Author:** ![Abebe\_Biru](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/abebe_biru/32/9742_2.png) [@Abebe\_Biru](https://staging-discuss.dev.twitch.com/u/Abebe_Biru)\
**Post date:** [July 22, 2020, 6:46pm UTC](https://staging-discuss.dev.twitch.com/t/twitch-webhook-subscription-gets-created-successfully-but-not-receiving-updates/27276/3 "2020-07-22T18:46:05Z")

</div>

Here is the screenshot of debug sessions and below is the code

 ![Capture](https://d2spem0quai2ol.cloudfront.net/original/2X/2/29755434568d544ec63fabd419be4716bbc9a840.png)

public async Task SubscribeAsync(TwitchSubscriptionContext context, CancellationToken cancellationToken)  
{  
context.ThrowIfNull(nameof(context));  
context.Callback.ThrowIfNullOrWhiteSpace(nameof(context.Callback));  
var subscriptionPayLoad = new TwitchSubscription(context.StreamerMetadataId, this.clientSecret, context.Action, context.LeaseSeconds, context.Callback);  
using (StringContent requestBody = TwitchClient.CreateJsonContent(subscriptionPayLoad.ToJson()))  
{  
using (var clientBuilder = new RestClientBuilder())  
{  
await this.AddCredentialHeadersAsync(clientBuilder, cancellationToken);  
var client = clientBuilder.Build();  
var requestUri = new Uri(TwitchClient.WebooksUrl);  
var response = await client.PostAsync(requestUri, requestBody, cancellationToken);  
if (response?.Content == null || !response.IsSuccessStatusCode)  
{  
return null;  
}

```
                return new SubscriptionInfo()
                {
                    Subscribed = true,
                    ExpirationDateTime = DateTime.UtcNow.AddSeconds(subscriptionPayLoad.LeaseSeconds),
                    StartDateTime = DateTime.UtcNow,
                };
            }
        }
    }

```

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://staging-discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [July 22, 2020, 6:53pm UTC](https://staging-discuss.dev.twitch.com/t/twitch-webhook-subscription-gets-created-successfully-but-not-receiving-updates/27276/4 "2020-07-22T18:53:08Z")

</div>

Your callback is returning

```
"theHubChallenge"

```

instead of

```
theHubChallenge

```

 ![image](https://d2spem0quai2ol.cloudfront.net/original/2X/b/b482304d1914ff7799fa7f4478f6bde1f50001a5.png)

Your have wrapped the challenge in `"`

---

<div class="post-metadata">

**Author:** ![Abebe\_Biru](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/abebe_biru/32/9742_2.png) [@Abebe\_Biru](https://staging-discuss.dev.twitch.com/u/Abebe_Biru)\
**Post date:** [July 22, 2020, 7:55pm UTC](https://staging-discuss.dev.twitch.com/t/twitch-webhook-subscription-gets-created-successfully-but-not-receiving-updates/27276/5 "2020-07-22T19:55:13Z")

</div>

Thank you!  
[Produces(“application/json”)] header on my controller was wrapping challenge token with “”

---

<div class="post-metadata">

**Author:** ![system](https://d2spem0quai2ol.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://staging-discuss.dev.twitch.com/u/system)\
**Post date:** [August 21, 2020, 8:09pm UTC](https://staging-discuss.dev.twitch.com/t/twitch-webhook-subscription-gets-created-successfully-but-not-receiving-updates/27276/6 "2020-08-21T20:09:35Z")

</div>

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