Update provider credentials
Update credentials for a provider such as slack and push tokens. providerId is required field. This API appends the deviceTokens to the existing ones.
Authorization
Authorization
<token>API key authentication. Allowed headers-- "Authorization: ApiKey <api_key>".
In: header
Request Body
application/json
RequiredproviderId
RequiredstringThe provider identifier for the credentials
"slack" | "discord" | "msteams" | "mattermost" | "ryver" | "zulip" | "grafana-on-call" | "getstream" | "rocket-chat" | "whatsapp-business" | "chat-webhook" | "fcm" | "apns" | "expo" | "one-signal" | "pushpad" | "push-webhook" | "pusher-beams"
integrationIdentifier
stringThe integration identifier
credentials
RequiredobjectCredentials payload for the specified provider
Path Parameters
subscriberId
RequiredstringHeader Parameters
idempotency-key
stringA header for idempotency purposes
Response Body
OK
_id
stringThe internal ID generated by Novu for your subscriber. This ID does not match the subscriberId
used in your queries. Refer to subscriberId
for that identifier.
firstName
string | nullThe first name of the subscriber.
lastName
string | nullThe last name of the subscriber.
email
string | nullThe email address of the subscriber.
phone
string | nullThe phone number of the subscriber.
avatar
string | nullThe URL of the subscriber's avatar image.
locale
string | nullThe locale setting of the subscriber, indicating their preferred language or region.
channels
array<object>An array of channel settings associated with the subscriber.
topics
Deprecatedarray<string>An array of topics that the subscriber is subscribed to.
isOnline
boolean | nullIndicates whether the subscriber is currently online.
lastOnlineAt
string | nullThe timestamp indicating when the subscriber was last online, in ISO 8601 format.
__v
numberThe version of the subscriber document.
data
object | nullAdditional custom data for the subscriber
timezone
string | nullTimezone of the subscriber
subscriberId
RequiredstringThe identifier used to create this subscriber, which typically corresponds to the user ID in your system.
_organizationId
RequiredstringThe unique identifier of the organization to which the subscriber belongs.
_environmentId
RequiredstringThe unique identifier of the environment associated with this subscriber.
deleted
RequiredbooleanIndicates whether the subscriber has been deleted.
createdAt
RequiredstringThe timestamp indicating when the subscriber was created, in ISO 8601 format.
updatedAt
RequiredstringThe timestamp indicating when the subscriber was last updated, in ISO 8601 format.
export interface Response {
/**
* The internal ID generated by Novu for your subscriber. This ID does not match the `subscriberId` used in your queries. Refer to `subscriberId` for that identifier.
*/
_id?: string;
/**
* The first name of the subscriber.
*/
firstName?: string | null;
/**
* The last name of the subscriber.
*/
lastName?: string | null;
/**
* The email address of the subscriber.
*/
email?: string | null;
/**
* The phone number of the subscriber.
*/
phone?: string | null;
/**
* The URL of the subscriber's avatar image.
*/
avatar?: string | null;
/**
* The locale setting of the subscriber, indicating their preferred language or region.
*/
locale?: string | null;
/**
* An array of channel settings associated with the subscriber.
*/
channels?: ChannelSettingsDto[];
/**
* @deprecated
* An array of topics that the subscriber is subscribed to.
*/
topics?: string[];
/**
* Indicates whether the subscriber is currently online.
*/
isOnline?: boolean | null;
/**
* The timestamp indicating when the subscriber was last online, in ISO 8601 format.
*/
lastOnlineAt?: string | null;
/**
* The version of the subscriber document.
*/
__v?: number;
/**
* Additional custom data for the subscriber
*/
data?: {
[k: string]: unknown;
} | null;
/**
* Timezone of the subscriber
*/
timezone?: string | null;
/**
* The identifier used to create this subscriber, which typically corresponds to the user ID in your system.
*/
subscriberId: string;
/**
* The unique identifier of the organization to which the subscriber belongs.
*/
_organizationId: string;
/**
* The unique identifier of the environment associated with this subscriber.
*/
_environmentId: string;
/**
* Indicates whether the subscriber has been deleted.
*/
deleted: boolean;
/**
* The timestamp indicating when the subscriber was created, in ISO 8601 format.
*/
createdAt: string;
/**
* The timestamp indicating when the subscriber was last updated, in ISO 8601 format.
*/
updatedAt: string;
}
export interface ChannelSettingsDto {
/**
* The provider identifier for the credentials
*/
providerId:
| "slack"
| "discord"
| "msteams"
| "mattermost"
| "ryver"
| "zulip"
| "grafana-on-call"
| "getstream"
| "rocket-chat"
| "whatsapp-business"
| "chat-webhook"
| "fcm"
| "apns"
| "expo"
| "one-signal"
| "pushpad"
| "push-webhook"
| "pusher-beams";
/**
* The integration identifier
*/
integrationIdentifier?: string;
/**
* Credentials payload for the specified provider
*/
credentials: ChannelCredentials;
/**
* The unique identifier of the integration associated with this channel.
*/
_integrationId: string;
}
export interface ChannelCredentials {
/**
* Webhook URL used by chat app integrations. The webhook should be obtained from the chat app provider.
*/
webhookUrl?: string;
/**
* Channel specification for Mattermost chat notifications.
*/
channel?: string;
/**
* Contains an array of the subscriber device tokens for a given provider. Used on Push integrations.
*/
deviceTokens?: string[];
/**
* Alert UID for Grafana on-call webhook payload.
*/
alertUid?: string;
/**
* Title to be used with Grafana on-call webhook.
*/
title?: string;
/**
* Image URL property for Grafana on-call webhook.
*/
imageUrl?: string;
/**
* State property for Grafana on-call webhook.
*/
state?: string;
/**
* Link to upstream details property for Grafana on-call webhook.
*/
externalUrl?: string;
}
curl -X PUT "https://api.novu.co/v1/subscribers/string/credentials" \
-H "idempotency-key: string" \
-H "Authorization: <token>" \
-H "Content-Type: application/json" \
-d '{
"providerId": "slack",
"integrationIdentifier": "string",
"credentials": {
"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"
}
}'
{
"_id": "string",
"firstName": "string",
"lastName": "string",
"email": "string",
"phone": "string",
"avatar": "string",
"locale": "string",
"channels": [
{
"providerId": "slack",
"integrationIdentifier": "string",
"credentials": {
"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"
},
"_integrationId": "string"
}
],
"topics": [
"string"
],
"isOnline": true,
"lastOnlineAt": "string",
"__v": 0,
"data": {},
"timezone": "string",
"subscriberId": "string",
"_organizationId": "string",
"_environmentId": "string",
"deleted": true,
"createdAt": "string",
"updatedAt": "string"
}