Skip to main content
POST
/
v1
/
integrations
/
channel-endpoints
/
oauth
PHP
declare(strict_types=1);

require 'vendor/autoload.php';

use novu;
use novu\Models\Components;

$sdk = novu\Novu::builder()
    ->setSecurity(
        'YOUR_SECRET_KEY_HERE'
    )
    ->build();

$generateLinkUserOauthUrlRequestDto = new Components\GenerateLinkUserOauthUrlRequestDto(
    subscriberId: 'subscriber-123',
    integrationIdentifier: '<value>',
    connectionIdentifier: 'slack-connection-abc123',
    context: [
        'key' => 'org-acme',
    ],
    userScope: [
        'identity.basic',
    ],
);

$response = $sdk->integrations->generateLinkUserOAuthUrl(
    generateLinkUserOauthUrlRequestDto: $generateLinkUserOauthUrlRequestDto
);

if ($response->generateChatOAuthUrlResponseDto !== null) {
    // handle response
}
{
  "url": "https://slack.com/oauth/v2/authorize?state=..."
}

Authorizations

Authorization
string
header
required

API key authentication. Allowed headers-- "Authorization: ApiKey <novu_secret_key>".

Headers

idempotency-key
string

A header for idempotency purposes

Body

application/json
subscriberId
string
required

The subscriber ID to link to their chat identity. Required — this operation always binds a specific subscriber to a user identity in the chat provider.

Example:

"subscriber-123"

integrationIdentifier
string
required

Integration identifier

connectionIdentifier
string

Identifier of the existing channel connection to associate this user endpoint with. Generated automatically if not provided.

Example:

"slack-connection-abc123"

context
object
userScope
string[]

Slack only: User-level OAuth scopes for "Sign in with Slack". Defaults to: identity.basic. MS Teams: ignored — uses delegated OpenID scopes (openid, profile, User.Read).

Example:
["identity.basic"]

Response

Created

url
string
required

The OAuth authorization URL for the chat provider. For Slack: https://slack.com/oauth/v2/authorize?... For MS Teams: https://login.microsoftonline.com/.../adminconsent?... This URL should be presented to the user to authorize the integration. Expires after 5 minutes.

Example:

"https://slack.com/oauth/v2/authorize?state=..."