Sam Houston
Sam Houston

Reputation: 3651

See more webhook information for Github's api

I have successfully set up a webhook for a github repo with the following request body:

body: JSON.stringify({
  name: 'web',
  events: ['issues'],
  active: true,
  config: {
    url: 'http://12345678.ngrok.io',
    content_type: 'json',
  }
})

When an issue is edited on the repo, I get a request to my ngrok server, but I cannot find out further information about the issue event.

The best I can get is in the request.headers I have:

{ host: '12345678.ngrok.io',
accept: '*/*',
'user-agent': 'GitHub-Hookshot/1234567',
'x-github-event': 'issues',
'x-github-delivery': '12341234-12341234-12341234',
'content-type': 'application/json',
'content-length': '7051',
'x-forwarded-for': '192.12.345.67' }

Can I also get than an issue was edited, what issue was edited and what it was edited to and from?

Upvotes: 0

Views: 130

Answers (1)

osowskit
osowskit

Reputation: 6334

The webhook event will have this in the payload. Here is an example.

There are examples in platform samples that show how to access the payload as JSON.

Upvotes: 1

Related Questions