Unable to receive POST messages from Webhook (Follow Users)

I have a project in .NET that uses HTTP Listener to get all the POST body sent to my IP.

public void StartListener()
{
using (var httpListener = new HttpListener())
{
httpListener.Prefixes.Add(@“http://192.168.1.8:6345/”);

  		try
  		{
  			httpListener.Start();
  		}
  		catch
  		{
  		}

  		while (httpListener.IsListening)
  		{
  			var context = httpListener.GetContext();
  			ProcessRequest(context);
  		}
  	}
  }

  private void ProcessRequest(HttpListenerContext context)
  {
  	// Get the data from the HTTP stream
  	var body = new StreamReader(context.Request.InputStream, context.Request.ContentEncoding).ReadToEnd();
  	Console.WriteLine(body);

  	byte[] b = Encoding.UTF8.GetBytes("ACK");
  	context.Response.StatusCode = 200;
  	context.Response.KeepAlive = false;
  	context.Response.ContentLength64 = b.Length;

  	var output = context.Response.OutputStream;
  	output.Write(b, 0, b.Length);
  	context.Response.Close();
  }

All my friends confirmed that they can send me a request with anything on the body and I will, in fact, see it on my console. However I tried subscribing to a Webhook using someone’s popular stream that I know would get a lot of follows (Shroud, for example).

https://api.twitch.tv/helix/webhooks/hub?hub.mode=subscribe&hub.topic=https://api.twitch.tv/helix/users/follows?to_id=37402112&hub.callback=http://MYPUBLICIP:6345&hub.lease_seconds=864000

For testing purposes I tried using other websites like requestb.in to see if they get the requests, and they do. However, I do not get any post messages back to my listener when subscribing to that webhook. So far it’s the only thing I can’t receive, if I do a simple request with anything on the body to “http://MYIP:6345”, I will receive it and see it in the console.

I am using Postman to make the requests. Any ideas what could be wrong?

Do you see the challenge GET that you don’t seem to be handling?

Is that IP even reachable from the internet? bcs that looks like an internal IP adress to me which cant be used for callback POST requests

I found the issue, turns out I did not respond to the challenge…

1 Like

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