Where to find the eventSub message id header?

The Twitch API EventSub documentation states that, quote

Every message includes a Twitch-Eventsub-Message-Id header.

However, I went through the headers of an eventSub message, and those are all the headers I could find:

‘Content-Type’,
‘application/json’,
‘Accept’,
/’,
‘Content-Length’,
‘452’,
‘User-Agent’,
‘node-fetch/1.0 (+https://github.com/bitinn/node-fetch)’,
‘Accept-Encoding’,
‘gzip,deflate’,
‘Connection’,
‘close’,
‘Host’,
myhostname.com

The message itself contains an “id” field under “subscription”, but it is verifiably unique for each message, even if the messages are identical.

That looks like the headers returned on a outbound fetch request

Not on an inbound request from Twitch to you. Which most likely would be part of express.

if you are using express to recieve webhooks

I am using Express, however those are indeed the headers I receive with the POST request from Twitch. I… think?

This is the code I use:

app.post(‘/events’, async (req, res) => {
console.log(req.body)
console.log(req.headers)
res.json({ statusCode: 200 })
})

If I try ['twitch-eventsub-message-id'] I simply get an undefined.

Am I doing something wrong?

The headers you listed in your OP are not from Twitch.

Since Twitch will send using a Go-http-client/1.1 based useragent and your headers show fetch

Example set of headers:

{
  host: 'REDACTED',
  'x-real-ip': 'REDACTED',
  'x-forwarded-for': 'REDACTED',
  'x-forwarded-proto': 'https',
  connection: 'close',
  'content-length': '557',
  'user-agent': 'Go-http-client/1.1',
  'content-type': 'application/json',
  'twitch-eventsub-message-id': 'b7ZqN7C4T8TBl3KWRLoA7C6bga3kf3-djGmleq6AnTw=',
  'twitch-eventsub-message-retry': '0',
  'twitch-eventsub-message-signature': 'sha256=REDACTED',
  'twitch-eventsub-message-timestamp': '2021-05-22T13:48:09.143057693Z',
  'twitch-eventsub-message-type': 'notification',
  'twitch-eventsub-subscription-is-batching-enabled': 'false',
  'twitch-eventsub-subscription-type': 'channel.follow',
  'twitch-eventsub-subscription-version': '1',
  'accept-encoding': 'gzip'
}

So that’s is a list of what you should get in your headers, when EventSub makes a call to you.

(x- headers are gonna vary by your server setup)

Oh, you are totally right.

I set up a proxy forwarding those messages to me, using node-fetch, a while ago and forgot about it.

Thank you.

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