Skip to content

Upload template

Upload Template File

This function upload_template_file() allows you to upload a template file to Blipper. The template file can contain placeholders (e.g., {{name}}) that will be filled in with specific data later.

Parameters:

  • filename: The name of the template file. This will be used to identify the template in Blipper.
  • file: The file object of the template file to upload.

Usage:

Use the upload_template_file method of the Blipper object, passing the filename and file object as parameters.

1
2
3
4
5
6
from blipper import Blipper

blipper = Blipper(api_key="my_api_key")

with open("files/template.html", "r", encoding="utf-8") as file:
    blipper.upload_template_file(filename="template.html", file=file)

In the example provided, a template file named template.html is opened and uploaded to Blipper. The filename parameter specifies the name of the file as it will be stored in Blipper, while the file parameter represents the opened file object.

Other formats

In addition to HTML template files, Blipper also supports the uploading of other document formats such as .docx files.

1
2
3
4
5
6
from blipper import Blipper

blipper = Blipper(api_key="my_api_key")

with open("files/template.docx", "rb") as file:
    blipper.upload_document_file(filename="template.docx", file=file)

Note

In addition to uploading template to Blipper, there are other functions available that can further enhance template functionality. These functions allow you to manipulate and populate templates with dynamic content, providing a more interactive and personalized user experience. Stay tuned for upcoming sections where we'll explore these additional functions to complete the information within the templates.