Starter Workflow for Creating Self-Signed PDF Agreements

Mar 17, 2023 | Programming

If you’re working on becoming GDPR compliant, we wrote a quick guide on how you can get prepared.

Deploy

PactMaker spins up a website with a form that lets your customers self-sign PDF agreements. After each agreement is signed, it sends an email with a copy of the PDF using Postmark. PactMaker is built with Node.js, Express, and EJS templating.

PactMaker Screenshot

Configuration

To get started with PactMaker, you first need to set up an environment variable file (.env) in the project root with the following variables:

  • POSTMARK_SERVER_TOKEN: Server tokens can be found under the credentials tab on your Postmark server.
  • POSTMARK_FROM_ADDRESS: The email address you want to send the email from, which must be verified.
  • INTERNAL_EMAIL_RECIPIENTS: A comma-separated list of email addresses to send the PDF agreement to.
  • INTERNAL_EMAIL_SUBJECT: The subject line of the email sent to your team. You can use variables like %= company %, %= name %, %= role %, and %= email %.
  • SIGNEE_EMAIL_SUBJECT: The subject line of the email sent to the person who signed the agreement, also supporting the same variables.
  • TITLE: Your company or app name, which will appear on the page header and footer.

Get Started

Before jumping in, ensure that your environment variable file is ready (see above) and that you have Node.js and npm installed on your system.


* In terminal, run: npm install
* Run: npm start or heroku local to run the project locally
* By default, npm start uses port 3000 and heroku local uses port 5000.

Email Templates

The email content for both the signee and internal email can be found in the emails directory. Templates are rendered using EJS, making it simple to personalize messages with variables like %= company %, %= name %, %= role %, and %= email %.

Agreement Template

The agreement PDF template is located at views/agreement.ejs. PactMaker comes with basic styles for displaying various signatures.

Autogenerated Example Agreement

It’s essential to allow your customers to preview the agreement before they sign it. PactMaker automatically generates an example agreement at the root URL, which can be shared with clients. Example values are available in examples.json.

Troubleshooting

While setting up PactMaker, you might encounter a few bumps along the way. Here are some quick solutions:

  • Missing Environment Variable: Double-check your .env file. Ensure that all required variables are present and correctly formatted.
  • Email Sending Issues: Validate that your Postmark settings are correctly configured, and the sender email is verified.
  • Server Not Starting: Make sure Node.js and npm are updated to the latest versions.
  • Template Rendering Errors: Review the EJS templates for any syntax errors, as a small mistake can cause rendering issues.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox