hellosign / hellosign-python-sdk

A Python SDK for HelloSign's API
MIT License
29 stars 48 forks source link

Use of text-merge (custom fields) with Embedded Signing #53

Open latoyazamill opened 5 years ago

latoyazamill commented 5 years ago

The documentation says "coming soon": https://app.hellosign.com/api/textTagsWalkthrough Section: Allowing a signer to edit pre-set values Example: custom_fields:[{"name":"organization_name", "value":"Enter organization name", "editor":"1", "required":"true"}]

neillom commented 4 years ago

I believe this is a duplicate of issue #21 . Can you confirm?

alexmac05 commented 4 years ago

@neillom This is not the same issue as #21. We will work towards showing more clear examples of both. We'll start with issue 21.

alexmac05 commented 4 years ago

@neillom

curl 'https://api.hellosign.com/v3/signature_request/send' \ -u 'API KEY:' \ -F 'title=NDA with Acme Co.' \ -F 'subject=The NDA we talked about' \ -F 'message=Please sign this NDA and then we can discuss more.' \ -F 'signers[1][email_address]=signer1@yahoo.com' \ -F 'signers[1][name]=Jack' \ -F 'custom_fields=[{"name":"organization_name", "value":"Enter organization name", "editor":"signer1", "required":"true"}]' \ -F 'file[0]=@texttags.pdf' \ -F 'use_text_tags=1' \ -F 'hide_text_tags=1' \ -F 'test_mode=1'

The above call with the attached file called texttags.pdf texttags.pdf

which has this on the pdf: [text-merge|req|signer1|organization_name|api_id]

Causes the functionality that represents this issue.

more info can be found here: https://app.hellosign.com/api/textTagsWalkthrough and this is different from #21. Both of these issues are implementations of custom fields but this issue is implementing custom fields using text tags and the other issue is implementing custom fields using hellosign end user templates. That is the main difference.

DESIRED RESULTS: Sending the following would have the same results as it does with the curl call.

signature_request = client.send_signature_request( test_mode=True, files=files, use_text_tags=True, hide_text_tags=False, file_urls=None, title="NDA with Acme Co.", subject="The NDA we talked about", message="Please sign this NDA and then we can discuss more.", signing_redirect_url=None, custom_fields=[{"name":"organization_name", "value":"Enter organization name", "editor":"signer1", "required":"true"}], signers=signers, client_id="CLIENT_ID_HERE", signing_options = {"draw": True, "type": True, "upload": True, "phone": False, "default": "type"},

texttags.pdf cc_email_addresses=cc_email_addresses)

print(signature_request)

Tested on version 3.8.9 and this has not been implemented yet.

janetanne commented 4 years ago

A workaround in the meantime would be to use a requests library. Example code here:

buildTheRequest = 'https://' + API_KEY + ':@api.hellosign.com/v3/signature_request/create_embedded'
data = {
        'client_id': CLIENT_ID,
        'file_url': 'FILE_URL_HERE',
        'subject': 'emb sig req w text tags',
        'signers[1][name]': 'SIGNER_NAME_HERE',
        'signers[1][email_address]':'EMAIL_ADDRESS_HERE',
        'custom_fields': '[{"name":"test1", "value":"Testing custom fields here"}]',
        'use_text_tags': 1,
        'hide_text_tags': 1,
        'test_mode': '1'
       }
print(buildTheRequest)
r = requests.post(buildTheRequest, data)
print(r.text)
janetanne commented 4 years ago

Adding another request to have this added to the SDK.

Internal reference number: 10930 Related ticket number: 11378488