diff --git a/packages/node/README.md b/packages/node/README.md index 882b361f008..741b247571c 100644 --- a/packages/node/README.md +++ b/packages/node/README.md @@ -275,6 +275,11 @@ await novu.subscribers.setCredentials("subscriberId", "fcm", { await novu.subscribers.setCredentials("subscriberId", "slack", { webhookUrl: ["webhookUrl"] }) + +// update slack weebhook for a subscriberId with selected integration +await novu.subscribers.setCredentials("subscriberId","slack",{ + webhookUrl: ["webhookUrl"] +},"identifier_slack") ``` - #### Delete provider credentials diff --git a/packages/node/src/lib/subscribers/subscriber.interface.ts b/packages/node/src/lib/subscribers/subscriber.interface.ts index 13a7e97a41d..00fe17881ae 100644 --- a/packages/node/src/lib/subscribers/subscriber.interface.ts +++ b/packages/node/src/lib/subscribers/subscriber.interface.ts @@ -25,7 +25,8 @@ export interface ISubscribers { setCredentials( subscriberId: string, providerId: string, - credentials: IChannelCredentials + credentials: IChannelCredentials, + integrationIdentifier?: string ); deleteCredentials(subscriberId: string, providerId: string); /** diff --git a/packages/node/src/lib/subscribers/subscribers.ts b/packages/node/src/lib/subscribers/subscribers.ts index d54635e14c1..5acc47e3f47 100644 --- a/packages/node/src/lib/subscribers/subscribers.ts +++ b/packages/node/src/lib/subscribers/subscribers.ts @@ -52,13 +52,15 @@ export class Subscribers extends WithHttp implements ISubscribers { async setCredentials( subscriberId: string, providerId: string, - credentials: IChannelCredentials + credentials: IChannelCredentials, + integrationIdentifier?: string ) { return await this.http.put(`/subscribers/${subscriberId}/credentials`, { providerId, credentials: { ...credentials, }, + ...(integrationIdentifier && { integrationIdentifier }), }); }