Skip to content

Latest commit

 

History

History
201 lines (143 loc) · 8.71 KB

README.md

File metadata and controls

201 lines (143 loc) · 8.71 KB

Credentials

(subscribers->credentials)

Overview

Available Operations

  • delete - Delete subscriber credentials by providerId
  • append - Modify subscriber credentials
  • update - Update subscriber credentials

delete

Delete subscriber credentials such as slack and expo tokens.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use novu;

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



$response = $sdk->subscribers->credentials->delete(
    subscriberId: '<id>',
    providerId: '<id>'

);

if ($response->statusCode === 200) {
    // handle response
}

Parameters

Parameter Type Required Description
subscriberId string ✔️ N/A
providerId string ✔️ N/A

Response

?Operations\SubscribersControllerDeleteSubscriberCredentialsResponse

Errors

Error Type Status Code Content Type
Errors\ErrorDto 400, 404, 409 application/json
Errors\ValidationErrorDto 422 application/json
Errors\APIException 4XX, 5XX */*

append

Subscriber credentials associated to the delivery methods such as slack and push tokens.

This endpoint appends provided credentials and deviceTokens to the existing ones.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use novu;
use novu\Models\Components;

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

$updateSubscriberChannelRequestDto = new Components\UpdateSubscriberChannelRequestDto(
    providerId: Components\UpdateSubscriberChannelRequestDtoProviderId::Zulip,
    credentials: new Components\ChannelCredentials(
        webhookUrl: 'https://example.com/webhook',
        channel: 'general',
        deviceTokens: [
            'token1',
            'token2',
            'token3',
        ],
        alertUid: '12345-abcde',
        title: 'Critical Alert',
        imageUrl: 'https://example.com/image.png',
        state: 'resolved',
        externalUrl: 'https://example.com/details',
    ),
);

$response = $sdk->subscribers->credentials->append(
    subscriberId: '<id>',
    updateSubscriberChannelRequestDto: $updateSubscriberChannelRequestDto

);

if ($response->subscriberResponseDto !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
subscriberId string ✔️ N/A
updateSubscriberChannelRequestDto Components\UpdateSubscriberChannelRequestDto ✔️ N/A

Response

?Operations\SubscribersControllerModifySubscriberChannelResponse

Errors

Error Type Status Code Content Type
Errors\ErrorDto 400, 404, 409 application/json
Errors\ValidationErrorDto 422 application/json
Errors\APIException 4XX, 5XX */*

update

Subscriber credentials associated to the delivery methods such as slack and push tokens.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use novu;
use novu\Models\Components;

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

$updateSubscriberChannelRequestDto = new Components\UpdateSubscriberChannelRequestDto(
    providerId: Components\UpdateSubscriberChannelRequestDtoProviderId::Pushpad,
    credentials: new Components\ChannelCredentials(
        webhookUrl: 'https://example.com/webhook',
        channel: 'general',
        deviceTokens: [
            'token1',
            'token2',
            'token3',
        ],
        alertUid: '12345-abcde',
        title: 'Critical Alert',
        imageUrl: 'https://example.com/image.png',
        state: 'resolved',
        externalUrl: 'https://example.com/details',
    ),
);

$response = $sdk->subscribers->credentials->update(
    subscriberId: '<id>',
    updateSubscriberChannelRequestDto: $updateSubscriberChannelRequestDto

);

if ($response->subscriberResponseDto !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
subscriberId string ✔️ N/A
updateSubscriberChannelRequestDto Components\UpdateSubscriberChannelRequestDto ✔️ N/A

Response

?Operations\SubscribersControllerUpdateSubscriberChannelResponse

Errors

Error Type Status Code Content Type
Errors\ErrorDto 400, 404, 409 application/json
Errors\ValidationErrorDto 422 application/json
Errors\APIException 4XX, 5XX */*