Docusign API Integration with Django WebApp

Docusign Integration with Django

Posted on May 19, 2020 by Apeksha Khanna | Blog | Total Hits:

A Quick Overview about DocuSign: -

DocuSign is a platform that allows users to digitally sign documents. Signatures and documents uploaded on the app or site, are encrypted and protected with unique hash /code. This unique hash secures and protects the data uploaded by the user. if a document has been tampered or compro-mised with, then the generated hash will not match the information stored by DocuSign.

DocuSign sets the priority to data privacy and security.

Tasks we followed to integrate DocuSign with Django for a Medical Website: -

● Add Patient form in Django

● Generate pdf in Django

● Sign pdf with Docusign API

● Save signed pdf in Django

● Mail pdf to Hospital

Detail Procedure: -

● User can add common details like name, contact details etc in form. On submission, data will be saved in the database.

● When the form is submitted, form data is converted into HTML template by Django and then the HTML template is converted to pdf by xhtml2pdf (python module).

● Auto Oauth2 token is requested by using REST DocuSign API through DocuSign python-client package.

● Now Envelope is created by DocuSign python-client containing Oauth2 token, pdf (generated previously) & account info.

● This envelope is sent to DocuSign by DocuSign REST API requests. After sending envelop, Unsigned pdf is auto-deleted.

● Our page is auto-redirected to an iframe embedded in Django Template, where signer can sign a document within a click.

● With envelop id generated in the signing process, Again request with envelop id, account info & Oauth2 token is sent to Docusign.

● This request returns back signed pdf as a response. Now signed pdf is saved inside server temp folder & mailed to hospital by Django send mail inbuild class using SMTP server.

● If mail is successful, Pdf is deleted otherwise it remains on the server.

Challenges Faced:-

● Docusign python-client functions support python version =>3.7, But the client was using 3.6, So we replaced unsupportive functions with supportive functions.

● There are many methods of signing documents on Docusign, its difficult to choose one which suits your requirements. We tried every method and then select best which suits our requirements. We have here used Embed Signing method.

● There are three methods of Oauth2 token generation. You have to choose which suits best for your needs and code accordingly as every method have different steps to generate Oauth2 token. We have used JSON Web Token grand method.

● For support only python code functions are provided, We have to code from the core with understanding those functions for integration with Django which is much time-consuming.

Our Address

  • 106 & 107, 1st Floor, Jyoti Shikhar Tower, District Centre, Janakpuri, New Delhi - 110058, India

Phone Number

  • +91 9910130340