refactor(signalwire): utilize axios post params
This commit is contained in:
@@ -35,15 +35,18 @@ export default defineAction({
|
|||||||
|
|
||||||
async run($) {
|
async run($) {
|
||||||
const requestPath = `/api/laml/2010-04-01/Accounts/${$.auth.data.accountSid}/Messages`;
|
const requestPath = `/api/laml/2010-04-01/Accounts/${$.auth.data.accountSid}/Messages`;
|
||||||
const messageBody = $.step.parameters.message;
|
|
||||||
|
|
||||||
const fromNumber = '%2B' + ($.step.parameters.fromNumber as string).trim();
|
const Body = $.step.parameters.message;
|
||||||
const toNumber = '%2B' + ($.step.parameters.toNumber as string).trim();
|
const From = '+' + ($.step.parameters.fromNumber as string).trim();
|
||||||
|
const To = '+' + ($.step.parameters.toNumber as string).trim();
|
||||||
|
|
||||||
const response = await $.http.post(
|
const response = await $.http.post(requestPath, null, {
|
||||||
'https://' + $.auth.data.spaceName + '.' + $.auth.data.spaceRegion + 'signalwire.com' + requestPath,
|
params: {
|
||||||
`Body=${messageBody}&From=${fromNumber}&To=${toNumber}`
|
Body,
|
||||||
);
|
From,
|
||||||
|
To,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$.setActionItem({ raw: response.data });
|
$.setActionItem({ raw: response.data });
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user