Skip to content

Commit 9ad28fa

Browse files
authored
fix: update smsenvoi payload (#37)
1 parent 14ed0c7 commit 9ad28fa

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

lib/messenger-clients/SMSEnvoiClient.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,22 @@ export class SMSEnvoiClient extends MessengerClient<SMSEnvoiAccount> {
8484
const payload = {
8585
message_type: "PRM",
8686
message: sms.body,
87-
recipient: sms.to,
87+
recipient: [sms.to],
8888
returnCredits: true,
89+
sender: sms.from,
8990
};
9091

91-
const response = await axios.post(
92-
"https://api.smsenvoi.com/API/v1.0/REST/sms",
93-
payload,
94-
{ headers },
95-
);
92+
try {
93+
const response = await axios.post(
94+
"https://api.smsenvoi.com/API/v1.0/REST/sms",
95+
payload,
96+
{ headers },
97+
);
9698

97-
return response.data;
99+
return response.data;
100+
} catch (e) {
101+
throw Error(e.resonse.data.result);
102+
}
98103
}
99104
}
100105
}

0 commit comments

Comments
 (0)