Shell Python Node PHP C# Ruby

Webhook OAuth

Registering a Webhook with OAuth Parameters

curl "https://api.payload.co/webhooks/" \
    -u secret_key_3bW9JMZtPVDOfFNzwRdfE: \
    -d trigger="payment" \
    -d url="https://yourdomain.com/path/to/webhook/handler" \
    -d oauth_params[grant_type]="client_credentials" \
    -d oauth_params[client_id]="58d5c805-bf35-4c3d-a722-4e09a2af7a11" \
    -d oauth_params[client_secret]="UdfghhY.IZB=F-kuxehjyAl:ty9m[k/" \
    -d oauth_params[resource]=" " \
    -d oauth_params[auth_url]="https://login.microsoftonline.com/gh572c30-debb-41a6-9c78-05dfgghhfa0d/oauth2/token"
webhook = pl.Webhook.create(
    trigger='payment',
    url='https://yourdomain.com/path/to/webhook/handler',
    oauth_params={
        'grant_type': 'client_credentials',
        'client_id': '58d5c805-bf35-4c3d-a722-4e09a2af7a11',
        'client_secret': 'UdfghhY.IZB=F-kuxehjyAl:ty9m[k/',
        'resource': ' ',
        'auth_url': 'https://login.microsoftonline.com/gh572c30-debb-41a6-9c78-05dfgghhfa0d/oauth2/token'
        })
<?php
$webhook = Payload\Webhook::create(array(
    'trigger' => 'payment',
    'url' => 'https://yourdomain.com/path/to/webhook/handler',
    'oauth_params' => array(
        'client_id' => '58d5c805-bf35-4c3d-a722-4e09a2af7a11',
        'client_secret'=> 'UdfghhY.IZB=F-kuxehjyAl:ty9m[k/' ,
        'grant_type' => 'client_credentials',
        'resource' => '' ,
        'auth_url' => 'https://login.microsoftonline.com/gh572c30-debb-41a6-9c78-05dfgghhfa0d/oauth2/token',
    )
));
?>
const webhook = await pl.Webhook.create({
    trigger: 'payment',
    url: 'https://yourdomain.com/path/to/webhook/handler',
    oauth_params: {
        'client_id' : '58d5c805-bf35-4c3d-a722-4e09a2af7a11',
        'client_secret': 'UdfghhY.IZB=F-kuxehjyAl:ty9m[k/',
        'grant_type' : 'client_credentials',
        'resource' : ' ',
        'auth_url' : 'https://login.microsoftonline.com/gh572c30-debb-41a6-9c78-05dfgghhfa0d/oauth2/token',
    }
})
var webhook = await pl.Webhook.CreateAsync(new {
    trigger = "payment",
    url = "https://yourdomain.com/path/to/webhook/handler",
    oauth_params = new {
        client_id = "58d5c805-bf35-4c3d-a722-4e09a2af7a11" ,
        client_secret=  "UdfghhY.IZB=F-kuxehjyAl:ty9m[k/",
        grant_type = "client_credentials",
        resource = " " ,
        auth_url = "https://login.microsoftonline.com/gh572c30-debb-41a6-9c78-05dfgghhfa0d/oauth2/token",
    }
});

To add OAuth parameters to a Webhook, include the following fields in the oauth_params field when creating the Webhook. The retrieved token will be passed in the request headers to the webhook url.

field name required/optional
client_id required
client_secret required
grant_type required
resource optional
auth_url required