write service_provider_sid with alerts

This commit is contained in:
Dave Horton
2022-09-07 23:51:40 +02:00
parent e90ef6bc70
commit 889257d7db
14 changed files with 85 additions and 175 deletions

View File

@@ -18,8 +18,8 @@ function basicAuth(username, password) {
class HttpRequestor extends BaseRequestor {
constructor(logger, account_sid, hook, secret) {
super(logger, account_sid, hook, secret);
constructor(logger, service_provider_sid, account_sid, hook, secret) {
super(logger, service_provider_sid, account_sid, hook, secret);
this.method = hook.method || 'POST';
this.authHeader = basicAuth(hook.username, hook.password);
@@ -142,7 +142,7 @@ class HttpRequestor extends BaseRequestor {
this.logger.error({err, baseUrl: this.baseUrl, url},
'web callback returned unexpected error');
}
let opts = {account_sid: this.account_sid};
let opts = {account_sid: this.account_sid, service_provider_sid: this.service_provider_sid};
if (err.code === 'ECONNREFUSED') {
opts = {...opts, alert_type: this.Alerter.AlertType.WEBHOOK_CONNECTION_FAILURE, url};
}