diff --git a/transports/sms.js b/transports/sms.js index d71ddee..7f65cef 100644 --- a/transports/sms.js +++ b/transports/sms.js @@ -34,7 +34,22 @@ export async function send_message(req, opts, res) { const num = opts.userTransport || await userDb_controller.get_phone_number(req); if (utils.check_transport_validity('sms', num)) { const url = urlBroker(num, opts.message); - + if (properties.getEsupProperty('sms').method) { + requestOpts.method = properties.getEsupProperty('sms').method; + } + if (properties.getEsupProperty('sms').body) { + const body = properties.getEsupProperty('sms').body.replace('$phoneNumber$', encodeURIComponent(num)).replace('$message$', encodeURIComponent(opts.message)); + requestOpts.body = body; + } + if (properties.getEsupProperty('sms').headers) { + if (! requestOpts.headers) { + requestOpts.headers = {}; + } + for (const k in properties.getEsupProperty('sms').headers) { + requestOpts.headers[k] = properties.getEsupProperty('sms').headers[k]; + } + } + let sms_response; try { sms_response = await request(url, requestOpts);