Merge pull request #3205 from woj-tek/master

Add option to use ApiKeys in Twilio in addition to main account credentials
pull/3318/head
Louis Lam 2 years ago committed by GitHub
commit e5c6783781
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -10,6 +10,7 @@ class Twilio extends NotificationProvider {
let okMsg = "Sent Successfully."; let okMsg = "Sent Successfully.";
let accountSID = notification.twilioAccountSID; let accountSID = notification.twilioAccountSID;
let apiKey = notification.twilioApiKey ? notification.twilioApiKey : accountSID;
let authToken = notification.twilioAuthToken; let authToken = notification.twilioAuthToken;
try { try {
@ -17,7 +18,7 @@ class Twilio extends NotificationProvider {
let config = { let config = {
headers: { headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=utf-8", "Content-Type": "application/x-www-form-urlencoded;charset=utf-8",
"Authorization": "Basic " + Buffer.from(accountSID + ":" + authToken).toString("base64"), "Authorization": "Basic " + Buffer.from(apiKey + ":" + authToken).toString("base64"),
} }
}; };

@ -5,7 +5,18 @@
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label for="twilio-auth-token" class="form-label">{{ $t("Auth Token") }}</label> <label for="twilio-apikey-token" class="form-label">{{ $t("Api Key (optional)") }}</label>
<input id="twilio-apikey-token" v-model="$parent.notification.twilioApiKey" type="text" class="form-control">
<div class="form-text">
<p>
The API key is optional but recommended. You can provide either Account SID and AuthToken
from the may TwilioConsole page or Account SID and the pair of Api Key and Api Key secret
</p>
</div>
</div>
<div class="mb-3">
<label for="twilio-auth-token" class="form-label">{{ $t("Auth Token / Api Key Secret") }}</label>
<input id="twilio-auth-token" v-model="$parent.notification.twilioAuthToken" type="text" class="form-control" required> <input id="twilio-auth-token" v-model="$parent.notification.twilioAuthToken" type="text" class="form-control" required>
</div> </div>

@ -730,7 +730,8 @@
"ntfyAuthenticationMethod": "Authentication Method", "ntfyAuthenticationMethod": "Authentication Method",
"ntfyUsernameAndPassword": "Username and Password", "ntfyUsernameAndPassword": "Username and Password",
"twilioAccountSID": "Account SID", "twilioAccountSID": "Account SID",
"twilioAuthToken": "Auth Token", "twilioApiKey": "Api Key (optional)",
"twilioAuthToken": "Auth Token / Api Key Secret",
"twilioFromNumber": "From Number", "twilioFromNumber": "From Number",
"twilioToNumber": "To Number", "twilioToNumber": "To Number",
"Monitor Setting": "{0}'s Monitor Setting", "Monitor Setting": "{0}'s Monitor Setting",

Loading…
Cancel
Save