Templafy's Document Generation API endpoints can easily be accessed and used with the Templafy Connector in Microsoft Power Platform and Copilot. This allows users to generate Word documents, PowerPoint presentations, Excel workbooks, or PDF files from workflows or agents in Copilot Studio, Microsoft Power Automate, Microsoft Power Apps, and Azure Logic Apps.
Prerequisites
|
How to create an API token for Document Generation
In order to interact with the API to generate documents, you must generate an API key in the Templafy Admin Center.
- Navigate to the Account section.
- In the API Keys tab, click Create key.
- Provide a name to the key.
- Click Next.
- Click Add scope and select:
-
library.generate: to interact with the/generateendpoint.
-
- Click Create.
- Click Copy key.
How to use the Templafy Connector in Power Automate
Add the Templafy Generate a document action to a flow
Once you've created a flow in Power Automate, Templafy can be added as an action in this flow.
- Click on the + button where you'd like to add the Templafy action.
- Search for "Templafy" and select Generate a document:
- Create a connection to your Templafy tenant by filling in the following information, and clicking Create New:
- Connection name: Name the connection something recognizable.
- Templafy tenant ID: The subdomain of your Templafy tenant.
- API version: We recommend using the latest stable version, which can be found here: https://api.templafy.com/. For example, "v3".
-
API Key: Add "Bearer " before pasting the API key generated in the steps above. This should look like: "Bearer YourAPIKey".
- Fill in the parameters relating to the document that will be generated. Most parameters (except dropdowns) can be set dynamically with fields or functions from previous flow steps.
- Space ID: ID of the space where the template is stored.
- Template type: type of template.
- Asset ID: ID of the template.
- Email (optional): Email address to identify the user in Templafy.
- Data (optional): Data to be used in file generation in JSON format. This is where information from previous steps in the flow can be defined for use in a document.
-
Include PDF?: If set to "Yes", the response will include a pdf download link.
-
Templafy will return a field, "downloadURL", or if you have set "Include PDF?" to "Yes", the field "pdfDownloadUrl" will be returned containing a temporary download URL. Add an action to download and save or open the file.
Important
The returned "downloadURL" and "pdfDownloadUrl" values are temporary URLs from where the generated files can be downloaded. These URLs are only valid for 30 minutes after creation, so the file must be downloaded and saved immediately as part of the flow.
How to add the Templafy Connector in Copilot Studio
In Copilot Studio, create an Agent. Once you have your initial agent created, you can add Templafy as a tool.
- In the Overview tab of the agent you've created, scroll to the Tools section:
- Click on + Add tool and search for "Templafy".
- Select the Templafy result, "Generate a document".
- Click on the Connection option, and select Create new connection:
- Create a connection to your Templafy tenant by filling in the following information, and clicking Create.
- Templafy tenant ID: The subdomain of your Templafy tenant.
- API version: We recommend using the latest stable version, which can be found here: https://api.templafy.com/. For example, "v3".
- API Key: Add "Bearer " before pasting the API key generated in the steps above. This should look like: "Bearer YourAPIKey".
- Click on Add and configure:
- Scroll to the Inputs and fill in the following fields:
- Space ID: ID of the space where the template is stored.
- Template type: type of template.
- Asset ID: ID of the template.
- Email: Email address to identify the user in Templafy.
- Data: Data to be used in file generation in JSON format.
-
Include PDF?: If set to "true", the response will include a pdf download link.
Note
- For fields like "Space ID, "Template type", "Asset ID", and "Include PDF?", we recommend setting those to "Custom value" and filling in the Values during setup.
- For "Email" and "Data", you can choose "Dynamically fill with AI", but make sure to click Customize to give further instructions. For example, instruct the tool using Description to format the "Data" as .json and include specific fields.
- Click Save.
Comments
Article is closed for comments.