A *service case study: Generating a PDF in your program with APITemplate.io
Users have reached out to us asking if it is possible to dynamically generate a customized PDF that they can share with the participants of their survey. While GuidedTrack does not have that functionality, you can easily integrate with external services via REST API to do so. There are a number of solutions available, such as APITemplate.io, PDF Generator API, and PDF Monkey. All three of them are paid services, although APITemplate.io and PDF Monkey both offer a free plan for that allows you to generate a small number of PDFs a month for free. On this case study we will show you how to configure and write a program that generates a PDF using APITemplate.io. Let’s say you have written the following program for a quick happiness assessment:
As you can see, four variables are generated: Generating the PDF template
Click on Launch WYSIWYG Editor to edit the template. Use it as a word processor, and surround with double curly brackets the name of any variable that will be received from your program. For example, our template below has four variables: name, happinessScore, happinessEval and motivationalPhrase: Go to the JSON tab to generate a JSON object with some test values so that you can see the template in action. This is the JSON object we have created for our example:
And this is the PDF it generates: Now that you have a template ready, you can do the integration with GuidedTrack! Before you leave the APITemplate.io site, there are two things that you will need. One is your template’s id, which can be found in the tab Manage templates next to the template’s name. Then go to the API integration tab to locate your API key. Configuring the serviceGo to the settings>services tab in your program and create a new service with the following data: Name: URL: pdfGenerator Click on + Add header and fill it up like this (using your own API key): Key: Value: X-API-KEY 801aNjA5NjozMTE0Sk9YaG9JH3BYanIwVkVzTGa Writing your programHere is the code to add to the program, after the variables have been generated, to connect with APITemplate.io:
First, we have created a variable named Then we call the If all goes well, the object |