Skip to content

Commit

Permalink
feat(pkg): added integrationidentifier in setcredential method in nod…
Browse files Browse the repository at this point in the history
…e sdk (#4994)

Co-authored-by: Prashant Puri <[email protected]>
  • Loading branch information
Prashant-dot1 and Prashant Puri authored Dec 19, 2023
1 parent 46dce5c commit ff5c93d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions packages/node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion packages/node/src/lib/subscribers/subscriber.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export interface ISubscribers {
setCredentials(
subscriberId: string,
providerId: string,
credentials: IChannelCredentials
credentials: IChannelCredentials,
integrationIdentifier?: string
);
deleteCredentials(subscriberId: string, providerId: string);
/**
Expand Down
4 changes: 3 additions & 1 deletion packages/node/src/lib/subscribers/subscribers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }),
});
}

Expand Down

0 comments on commit ff5c93d

Please sign in to comment.