Skip to content

Commit

Permalink
Merge pull request #4650 from parveshsaini/feature/add-simpletexting-sms
Browse files Browse the repository at this point in the history
feat(provider): added simple-texting SMS provider
  • Loading branch information
BiswaViraj authored Oct 31, 2023
2 parents 96cc7c8 + 1c83d0f commit 46e67a7
Show file tree
Hide file tree
Showing 25 changed files with 482 additions and 210 deletions.
4 changes: 3 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,9 @@
"IDEMPOTENCY",
"Idempotency",
"messagebird",
"Datetime"
"Datetime",
"simpletexting",
"Simpletexting"
],
"flagWords": [],
"patterns": [
Expand Down
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.
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 @@ -69,6 +69,7 @@ const providers: Record<ChannelTypeEnum, ProvidersIdEnum[]> = {
SmsProviderIdEnum.AfricasTalking,
SmsProviderIdEnum.Novu,
SmsProviderIdEnum.Bandwidth,
SmsProviderIdEnum.Simpletexting,
].sort(),
],
};
Expand Down
9 changes: 9 additions & 0 deletions libs/shared/src/consts/providers/channels/sms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
sendchampConfig,
genericSmsConfig,
clickSendConfig,
simpleTextingConfig,
bandwidthConfig,
messagebirdConfig,
bulkSmsConfig,
Expand Down Expand Up @@ -216,6 +217,14 @@ 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.Simpletexting,
displayName: `SimpleTexting`,
channel: ChannelTypeEnum.SMS,
credentials: simpleTextingConfig,
docReference: 'https://simpletexting.com/api/docs/v2/',
logoFileName: { light: 'simpletexting.png', dark: 'simpletexting.png' },
},
{
id: SmsProviderIdEnum.Bandwidth,
displayName: `Bandwidth`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,16 @@ export const clickSendConfig: IConfigCredentials[] = [
...smsConfigBase,
];

export const simpleTextingConfig: IConfigCredentials[] = [
{
key: CredentialsKeyEnum.ApiKey,
displayName: 'API Key',
type: 'text',
required: true,
},
...smsConfigBase,
];

export const bandwidthConfig: IConfigCredentials[] = [
{
key: CredentialsKeyEnum.User,
Expand Down
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 @@ -85,6 +85,7 @@ export enum SmsProviderIdEnum {
Clicksend = 'clicksend',
Bandwidth = 'bandwidth',
MessageBird = 'messagebird',
Simpletexting = 'simpletexting',
}

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 @@ -89,6 +89,7 @@
"@novu/sendchamp": "^0.21.0",
"@novu/sendgrid": "^0.21.0",
"@novu/sendinblue": "^0.21.0",
"@novu/simpletexting": "^0.21.0",
"@novu/ses": "^0.21.0",
"@novu/shared": "^0.21.0",
"@novu/slack": "^0.21.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export * from './sms-central.handler';
export * from './africas-talking.handler';
export * from './sendchamp.handler';
export * from './clicksend.handler';
export * from './simpletexting.handler';
export * from './bandwidth.handler';
export * from './novu.handler';
export * from './generic-sms.handler';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { ChannelTypeEnum, ICredentials } from '@novu/shared';
import { SimpletextingSmsProvider } from '@novu/simpletexting';
import { BaseSmsHandler } from './base.handler';

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

buildProvider(credentials: ICredentials) {
const config = {
apiKey: credentials.apiKey,
accountPhone: credentials.from,
};

this.provider = new SimpletextingSmsProvider(config);
}
}
6 changes: 4 additions & 2 deletions packages/application-generic/src/factories/sms/sms.factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ import {
AfricasTalkingSmsHandler,
SendchampSmsHandler,
ClicksendSmsHandler,
SimpletextingSmsHandler,
BandwidthHandler,
NovuSmsHandler,
GenericSmsHandler,
MessageBirdHandler,
NovuSmsHandler,
} from './handlers';

export class SmsFactory implements ISmsFactory {
Expand All @@ -45,10 +46,11 @@ export class SmsFactory implements ISmsFactory {
new AfricasTalkingSmsHandler(),
new SendchampSmsHandler(),
new ClicksendSmsHandler(),
new SimpletextingSmsHandler(),
new BandwidthHandler(),
new NovuSmsHandler(),
new GenericSmsHandler(),
new MessageBirdHandler(),
new NovuSmsHandler(),
];

getHandler(integration: IntegrationEntity) {
Expand Down
Loading

1 comment on commit 46e67a7

@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.