Skip to content

Commit

Permalink
Merge pull request #4845 from novuhq/fix/override-in-sms-providers
Browse files Browse the repository at this point in the history
fix(sms): add options from in sms providers
  • Loading branch information
jainpawan21 authored Nov 14, 2023
2 parents b6d46b9 + 3468834 commit aad9114
Show file tree
Hide file tree
Showing 14 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class AfricasTalkingSmsProvider implements ISmsProvider {
options: ISmsOptions
): Promise<ISendMessageSuccessResponse> {
const response = await this.africasTalkingClient.send({
from: this.config.from,
from: options.from || this.config.from,
to: options.to,
message: options.content,
});
Expand Down
2 changes: 1 addition & 1 deletion providers/firetext/src/lib/firetext.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class FiretextSmsProvider implements ISmsProvider {
const baseMessage = {
apiKey: this.config.apiKey,
to: options.to,
from: this.config.from,
from: options.from || this.config.from,
message: options.content,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class FortySixElksSmsProvider implements ISmsProvider {
).toString('base64');

const data = new URLSearchParams({
from: this.config.from,
from: options.from || this.config.from,
to: options.to,
message: options.content,
}).toString();
Expand Down
2 changes: 1 addition & 1 deletion providers/generic-sms/src/lib/generic-sms.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class GenericSmsProvider implements ISmsProvider {
method: 'POST',
data: {
...options,
sender: this.config.from,
sender: options.from || this.config.from,
},
});

Expand Down
2 changes: 1 addition & 1 deletion providers/infobip/src/lib/infobip.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class InfobipSmsProvider implements ISmsProvider {
to: options.to,
},
],
from: this.config.from || options.from,
from: options.from || this.config.from,
},
],
});
Expand Down
2 changes: 1 addition & 1 deletion providers/kannel/src/lib/kannel.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class KannelSmsProvider implements ISmsProvider {
const queryParameters = {
username: this.config.username,
password: this.config.password,
from: this.config.from,
from: options.from || this.config.from,
to: options.to,
text: options.content,
};
Expand Down
2 changes: 1 addition & 1 deletion providers/maqsam/src/lib/maqsam.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class MaqsamSmsProvider implements ISmsProvider {
data: {
to: options.to,
message: options.content,
sender: this.config.from,
sender: options.from || this.config.from,
},
});

Expand Down
2 changes: 1 addition & 1 deletion providers/nexmo/src/lib/nexmo.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class NexmoSmsProvider implements ISmsProvider {
): Promise<ISendMessageSuccessResponse> {
const vonageResponseId: string = await new Promise((resolve, reject) => {
this.vonageClient.message.sendSms(
this.config.from,
options.from || this.config.from,
options.to,
options.content,
{},
Expand Down
2 changes: 1 addition & 1 deletion providers/plivo/src/lib/plivo.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class PlivoSmsProvider implements ISmsProvider {
options: ISmsOptions
): Promise<ISendMessageSuccessResponse> {
const plivoResponse = await this.plivoClient.messages.create(
this.config.from,
options.from || this.config.from,
options.to,
options.content
);
Expand Down
2 changes: 1 addition & 1 deletion providers/sendchamp/src/lib/sendchamp.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class SendchampSmsProvider implements ISmsProvider {
options: ISmsOptions
): Promise<ISendMessageSuccessResponse> {
const payload = {
sender_name: this.config.from,
sender_name: options.from || this.config.from,
to: options.to,
message: options.content,
route: 'international',
Expand Down
2 changes: 1 addition & 1 deletion providers/sms-central/src/lib/sms-central.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class SmsCentralSmsProvider implements ISmsProvider {
): Promise<ISendMessageSuccessResponse> {
const data = {
ACTION: 'send',
ORIGINATOR: this.config.from,
ORIGINATOR: options.from || this.config.from,
USERNAME: this.config.username,
PASSWORD: this.config.password,
RECIPIENT: options.to,
Expand Down
2 changes: 1 addition & 1 deletion providers/sms77/src/lib/sms77.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class Sms77SmsProvider implements ISmsProvider {
options: ISmsOptions
): Promise<ISendMessageSuccessResponse> {
const params: SmsParams = {
from: this.config.from,
from: options.from || this.config.from,
json: true,
text: options.content,
to: options.to,
Expand Down
2 changes: 1 addition & 1 deletion providers/telnyx/src/lib/telnyx.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class TelnyxSmsProvider implements ISmsProvider {
const telynxResponse = await this.telnyxClient.messages.create({
to: options.to,
text: options.content,
from: this.config.from,
from: options.from || this.config.from,
messaging_profile_id: this.config.messageProfileId,
});

Expand Down
2 changes: 1 addition & 1 deletion providers/twilio/src/lib/twilio.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class TwilioSmsProvider implements ISmsProvider {
const twilioResponse = await this.twilioClient.messages.create({
body: options.content,
to: options.to,
from: this.config.from,
from: options.from || this.config.from,
});

return {
Expand Down

0 comments on commit aad9114

Please sign in to comment.