Twilio FAX Send

Sending FAX by Twilio

    • C1. ID of Twilio. Acquired at Twilio console
    • C2. Password for accessing to API. Acquired at Twilio console
    • C3. Telephone number of FAX sending source. Acquired at Twilio console
    • I1. Telephone number of FAX sending destination
    • I2. Data to be sent
      • Specify PDF to be sent as FAX by URL
      • It must be a URL accessible from Twilio.
    • O1. Data item to store the Status check URL
    • O2. Data item to store FAX SID
    • O3. Data item to store error log
    • You need to create a project at Twilio console, and acquire ACCOUNT SID / AUTHTOKEN / Telephone number befroehand

    C1. ACCOUNT SIDRequired
    C2. AUTH TOKENRequired
    C3. From Telephone Number (You got at Twilio) ex. +8150XXXXXXXXRequired
    I1. To Telephone Number ex. +8175XXXXXXXXInserting EL expressions is also possibleRequired
    I2. URL of PDF sending as FAXInserting EL expressions is also possibleRequired
    O1. Data Item to save status confirmation urlData selectString(single line)
    O2. Data Item to save FAX SIDData selectString(single line)
    O3. Data Item to save errorData selectString(multiple line)
    -variable namevariable label
    C1AccountSidACCOUNT SID
    C2AuthTokenAUTH TOKEN
    C3FromFrom Telephone Number (You got at Twilio) ex. +8150XXXXXXXX
    I1ToTo Telephone Number ex. +8175XXXXXXXX
    I2PdfUrlURL of PDF sending as FAX
    O1StatusUrlItemData Item to save status confirmation url
    O2FaxSidItemData Item to save FAX SID
    O3ErrorItemData Item to save error
      var accountSid = configs.get("AccountSid");
      var authToken = configs.get("AuthToken");
      var from = configs.get("From");
      var to = configs.get("To");
      var pdfUrl = configs.get("PdfUrl");
      var statusUrlItem = configs.get("StatusUrlItem");
      var faxSidItem = configs.get("FaxSidItem");
      var errorItem = configs.get("ErrorItem");
      var response;
        response = httpClient.begin()
          .basic(accountSid, authToken)
          .formParam('To', to)
          .formParam('From', from)
          .formParam('MediaUrl', pdfUrl)
          .formParam('quality', 'standard')
      } catch(e) {
        if(errorItem != null) {
          engine.setDataByNumber(errorItem, e.message);
          return; // ここで終了
        throw e;
      if (response.getStatusCode() != 201) {
        var error = response.getStatusCode() + "\n" + response.getResponseAsString();
        if (errorItem != null) {
          engine.setDataByNumber(errorItem, error);
          return; // ここで終了
        throw error;
      var responseJson = JSON.parse(response.getResponseAsString());
      if (statusUrlItem != null) {
        engine.setDataByNumber(statusUrlItem, responseJson["url"]);
      if (faxSidItem != null) {
        engine.setDataByNumber(faxSidItem, responseJson["sid"]);
      engine.setDataByNumber(errorItem, '');