You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

Peter212's avatar
Peter212
Explorer | Level 3
4 months ago

[Dropbox Sign API] What is a best way to identify each document with their template after download

Hi, 

I have integration with Dropbox Sign API (earlier HelloSign) that downloads documents after they were signed. I am downloading a zip file, and I would like to save them with different names based on the template they were created with. Is there a way to identify which documents were created from which template? (Right now, I am using the template ids array, which comes with the 'signature_request_all_signed' event, and assuming that each file in the zip file will be in the same order as id in template ids array)

  • Hi there,
     

    Thanks for reaching out! When downloading your files with the `zip` option, the files will be returned in the order that they were uploaded to the signature request. 

     
    The method you are using by looking at the order of templates in the `template_ids` array of the `signature_request_all_signed` event is a great way to track the order that your files will appear in the downloaded .zip file.
     
    Additionally, using the metadata parameter when creating your signature request also gives you an option to include the names and order of the templates or files you are using in the request. The key-value data added with the metadata parameter will be included in all API responses and events involving the signature request. Here’s an example of how this would appear:
     
    "metadata": {
          "template_id_1": "First Template Name",
          "template_id_2": "Second Template Name",
          "template_id_3": "Third Template Name"
        }
     
    That way when you view the `signature_request_all_signed` event, you can also check the metadata array for the list of file names for easy reference when you go to update them after downloading the .zip file.
     
    Please let us know if you have any additional questions or if you run into any issues with template and file order. Thanks!
    • Peter212's avatar
      Peter212
      Explorer | Level 3

      Hi Spencer!

      Thank you for your answer.

      I am not sure if looking at the `template_ids` in the `signature_request_all_signed` is a good idea, because in my case the order of ids in it does not match the order in the template_ids passed when creating the `signature_request`:

      Prefixes of ids in the array send to /send_with_template endpoint:

      ['26ed0', '72ff1', 'be531', '90480', 'd9ab6']

      and the prefixes of ids received from `signature_request_all_signed` event payload

      ['90480', 'd9ab6', 'be531', '72ff1', '26ed0'].

       

      I love your idea of using metadata for that. I was wondering if I could send an array with the correct order of ids in it, so I don't have to base it on the callback event template_ids array in the wrong order

      • Spencer H's avatar
        Spencer H
        Icon for Dropbox Staff rankDropbox Staff
        Hi there,
         
        Thanks for you reply! For the request with the mismatched order of documents, could you please open a ticket with our Sign API team and provide the following information so we can take a closer look at this case:

        • The signature_request_id of the affected request
        • A code snippet / screenshot of signature request payload used when sending the request
        • A code snippet / screenshot of signature_request_all_signed event payload

        With this information, we’ll be able to investigate further on our end to see why these are not matching.
         
        In regards to the metadata parameter, you can set an array of template_ids with the parameter that would look like this in your callback events:

        "metadata": {
              "template_order": [
                "template_1",
                "template_2",
                "template_3"
              ]
            }

        Please note, there are some limitations to keep in mind. Each request can include up to 10 metadata keys (or 50 nested metadata keys), with key names up to 40 characters long and values up to 1000 characters long.
         
        I’ll keep an eye out for your ticket regarding the template_ids order mismatch!