You can use the API Action to make REST-based API calls. If the API you're integrating with is SOAP-based, the Code Editor is the tool for you.
Example
The following is an example of how you can leverage the fetch library embedded in the Code Editor runtime to perform SOAP requests.
The input variable should contain any stringified number, like "500". We build the XML body through a template literal and substitute the input value. We then extract the response value through Regex. The output message in the chat will then contain the number as words, "five hundred" in the case of our example.
// We make use of the following public API// https://documenter.getpostman.com/view/8854915/Szf26WHnconst { input } = args;consturl="https://www.dataaccess.com/webservicesserver/NumberConversion.wso";// The request bodyconstbody=`<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <NumberToWords xmlns="http://www.dataaccess.com/webservicesserver/"> <ubiNum>${input}</ubiNum> </NumberToWords> </soap:Body> </soap:Envelope>`;constheaders= {// Additional headers may be required// dpending on your server implementation"Content-Type":"text/xml; charset=utf-8",};constoptions= { method:"POST", headers, body };constchatlayer=ChatlayerResponseBuilder();try {// Perform the request to the SOAP apiconstresponse=awaitfetch(url, options);// Extract the text value from the responseconstxmlResponse=awaitresponse.text();// Build and match the RegExp to extract data from the responseconstregExp=newRegExp("<m:NumberToWordsResult>(.*?)</m:NumberToWordsResult>" );constmatch=xmlResponse.match(regExp);if (!match) {thrownewError("Could not find the given number"); }constresult= match[1];chatlayer.addMessage(result);} catch (ex) {chatlayer.addMessage(ex.toString());} finally {chatlayer.send();}