create organization webhooks via API

Hi,

I am trying to create organization webhooks programatically with my personal access token. I am sure that my token has all the organization admin scopes but I keep failing with the response 

{
  “message”: “Validation Failed”,
  “errors”: [
    {
      “resource”: “Hook”,
      “code”: “custom”,
      “message”: “Service hooks are not supported on organizations.”
    }
  ],
  “documentation_url”: “https://developer.github.com/v3/orgs/hooks/#create-a-hook
}

I am able to create organization webhook on web console without any problem.

Is there any thing may go wrong on my side ?

Thanks,

Shih Hsin

Without seeing what payload you’re sending to the API, it is hard to say what might be going wrong. But at a guess, I would think that your payload is malformed. The error message states that organizations don’t support service hooks. Service hooks are a deprecated part of the API and are no longer supported. Because you are getting this error message, I assume that you’re not submitting the right information to create a web hook. Possibly “name” is not set to “web”?