Skip to content

Commit

Permalink
Merge pull request #4551 from parveshsaini/feature/bandwidth-sms
Browse files Browse the repository at this point in the history
feat(provider): bandwidth SMS provider added
  • Loading branch information
BiswaViraj authored Oct 25, 2023
2 parents 79793bb + 04bc666 commit 79ffa2c
Show file tree
Hide file tree
Showing 22 changed files with 1,479 additions and 355 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const providers: Record<ChannelTypeEnum, ProvidersIdEnum[]> = {
SmsProviderIdEnum.Termii,
SmsProviderIdEnum.AfricasTalking,
SmsProviderIdEnum.Novu,
SmsProviderIdEnum.Bandwidth,
].sort(),
],
};
Expand Down
10 changes: 10 additions & 0 deletions libs/shared/src/consts/providers/channels/sms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
africasTalkingConfig,
sendchampConfig,
clickSendConfig,
bandwidthConfig,
} from '../credentials';
import { SmsProviderIdEnum } from '../provider.enum';

Expand Down Expand Up @@ -188,4 +189,13 @@ export const smsProviders: IProviderConfig[] = [
docReference: 'https://developers.clicksend.com/docs/rest/v3/?javascript--nodejs#send-sms',
logoFileName: { light: 'clicksend.png', dark: 'clicksend.png' },
},
{
id: SmsProviderIdEnum.Bandwidth,
displayName: `Bandwidth`,
channel: ChannelTypeEnum.SMS,
credentials: bandwidthConfig,
betaVersion: true,
docReference: 'https://dev.bandwidth.com/docs/messaging/createMessage',
logoFileName: { light: 'bandwidth.png', dark: 'bandwidth.png' },
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -767,3 +767,26 @@ export const clickSendConfig: IConfigCredentials[] = [
},
...smsConfigBase,
];

export const bandwidthConfig: IConfigCredentials[] = [
{
key: CredentialsKeyEnum.User,
displayName: 'Username',
description: 'Your Bandwidth account username',
type: 'text',
required: true,
},
{
key: CredentialsKeyEnum.Password,
displayName: 'Password',
type: 'password',
required: true,
},
{
key: CredentialsKeyEnum.AccountSid,
displayName: 'Account ID',
type: 'text',
required: true,
},
...smsConfigBase,
];
1 change: 1 addition & 0 deletions libs/shared/src/consts/providers/provider.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export enum SmsProviderIdEnum {
Novu = 'novu-sms',
Sendchamp = 'sendchamp',
Clicksend = 'clicksend',
Bandwidth = 'bandwidth',
}

export enum ChatProviderIdEnum {
Expand Down
1 change: 1 addition & 0 deletions packages/application-generic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"@google-cloud/storage": "^6.2.3",
"@novu/africas-talking": "^0.20.0",
"@novu/apns": "^0.20.0",
"@novu/bandwidth": "^0.20.0",
"@novu/burst-sms": "^0.20.0",
"@novu/clickatell": "^0.20.0",
"@novu/clicksend": "^0.20.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { ChannelTypeEnum, ICredentials } from '@novu/shared';
import { BandwidthSmsProvider } from '@novu/bandwidth';
import { BaseSmsHandler } from './base.handler';

export class BandwidthHandler extends BaseSmsHandler {
constructor() {
super('bandwidth', ChannelTypeEnum.SMS);
}

buildProvider(credentials: ICredentials) {
const config = {
username: credentials.user,
password: credentials.password,
accountId: credentials.accountSid,
};

this.provider = new BandwidthSmsProvider(config);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ export * from './sms-central.handler';
export * from './africas-talking.handler';
export * from './sendchamp.handler';
export * from './clicksend.handler';
export * from './bandwidth.handler';
export * from './novu.handler';
2 changes: 2 additions & 0 deletions packages/application-generic/src/factories/sms/sms.factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
AfricasTalkingSmsHandler,
SendchampSmsHandler,
ClicksendSmsHandler,
BandwidthHandler,
NovuSmsHandler,
} from './handlers';

Expand All @@ -42,6 +43,7 @@ export class SmsFactory implements ISmsFactory {
new AfricasTalkingSmsHandler(),
new SendchampSmsHandler(),
new ClicksendSmsHandler(),
new BandwidthHandler(),
new NovuSmsHandler(),
];

Expand Down
Loading

1 comment on commit 79ffa2c

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.