question

Sy Hasan avatar image
Sy Hasan asked Sy Hasan commented

Attaching Multiple Documents for Fax

Hi folks,

I'm trying to do some automation, but wanted to know if you can attach multiple documents to one request? It allows me to attach one document and fax successfully, but not a second or multiple. For example, this is what I have when writing it in JSON:

Request URL: https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~/fax
Request Body:

[
  {
    "control_type": "text",
    "label": "To",
    "name": "to",
    "type": "string",
    "optional": false
  },
  {
    "control_type": "text",
    "label": "Cover index",
    "name": "coverIndex",
    "type": "string",
    "optional": false
  },
  {
    "control_type": "text",
    "label": "Cover page text",
    "name": "coverPageText",
    "type": "string",
    "optional": false
  },
  {
    "name": "attachments",
    "type": "array",
    "optional": false,
    "binary_content": "false",
    "properties": []
  }
]
fax
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Yatin Gera avatar image
Yatin Gera Deactivated answered

Hi @Sy Hasan
From what I know and what I have tested, you have an option of attaching multiple files/documents to fax but they will get converted to a single pdf file (with multiple pages) and will be sent to the recipient.

What that means is that the recipient will have a single document with multiple pages in it which can represent different documents attached from the source.

Could you share more details about your use case and am I understanding it correctly that you want the recipient to receive multiple documents instead of a single file with multiple pages?

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image
Phong Vu answered Sy Hasan commented

Yes, you can send multiple attachments. Just make sure the total of all attachments size must not exceed the max size of 50MB. See this code sample using the RingCentral JS SDK.

async function send_fax() {
  try{
    var endpoint = "/restapi/v1.0/account/~/extension/~/fax"
    var FormData = require('form-data');
    formData = new FormData();
    var body = {
      to: [{'phoneNumber': "RECIPIENT_NUMBER", 'name': "Recipient name" }],
      faxResolution: "High"
      coverPageText: "This is a demo Fax page from Node JS\n \
Recipient company\n \
Sender name\n \
Fax number\n \
Subject is subject\n \
Comments/Notes"
    }

    formData.append('json', new Buffer.from(JSON.stringify(body)), {
        filename: 'text.json',
        contentType: 'application/json'
        });

    formData.append('attachment', require('fs').createReadStream('first_file.jpg'));
    formData.append('attachment', require('fs').createReadStream('second_file.png'));

    var resp = await platform.post(endpoint, formData)
    var jsonObj = await resp.json()
    console.log("FAX sent. Current status: " + jsonObj.messageStatus + "/" + jsonObj.id)
  }catch(e){
    console.log(e.messsage)
  }
}


See the dev guide documentation for more details

3 comments
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Sy Hasan avatar image Sy Hasan commented ·
Thanks Phong. However, how would I convert it to the format above? I am using Workato, which is similar to Postman to write this out. Unfortunately, I cannot use any other language format aside from JSON as I posted above. Thanks!
0 Likes 0 ·
Phong Vu avatar image Phong Vu ♦♦ Sy Hasan commented ·

I am not a Workato expert. You can either ask Workato support or check this out since you said that it is similar to Postman.

0 Likes 0 ·
Sy Hasan avatar image Sy Hasan Phong Vu ♦♦ commented ·

Cool, thanks for that.

0 Likes 0 ·

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys