Tilda Integration
Automatically create files through a form on your Tilda website. Visitors to your site can enter their name and other details to receive a ready-made file. If needed, the file can be sent to the recipient's email.
Creating a Form in Tilda
To submit requests for file creation, you need to create a form on your website. This form can be located either in the Personal Account or on the public part of the website. You can add any form available in the Tilda block catalog.
Form Settings
Click on the "Content" button in the bottom left corner of the form. Then, double-click on the "Data Reception from Form" header, and an additional switch "Custom script to accept data" will appear. Select this option. Enter the following address in the input field:
https://dimaker.app/api/v1/tilda-create/
Form settings window - data reception
Note that you need to send data without page reload (AJAX).
Input Fields
There should be at least one variable in the DiMaker document for replacement, for example %name or %course. The variable should be written in Latin characters. Cyrillic %фио or %класс cannot be used. Email address - %email.
In the form content in Tilda, add a "Single-line field" (or, for example, "Name", "Email"). In the "Field Title" field, write the data being requested, for example "Full Name", And in the "Variable Name" field, specify the variable name without the % sign from the document + the prefix mask_. For example, if the document contains %name, then the variable name in Tilda should be mask_name, if the document contains the variable %course, the variable name should be mask_course. The data entered by the visitor in these fields will be replaced by the corresponding variables in the text of the document.Adding the mask_name field, which corresponds to %name in the document
If you need to send the ready file via email, and the form is publicly accessible (not in the Personal Account), you need to add an Email field for entering the email address. In this case, the variable name will be "mask_email".
Adding the mask_email field, which corresponds to %email in the document
There can be any number of such input fields and variables in the document. You can request data from the visitor to then apply it to the ready file.
If you need to insert the current date, a random number, or other data, you should use functions.
Hidden Form Fields
Next, you need to create several hidden fields. They provide form identification, specify which document to use, in which folder in the Drive to save the file, and so on.
The form must have at least two required fields and, if necessary, several non-required ones.
Required form fields are marked with an asterisk.
secure *
Access token. Obtain it in the required Tilda integration, from the "Token" field.
-
doc_id *
The document ID needs to be obtained from the address bar when the document is opened. The ID is 36 characters long, without slashes. The document should not be in the trash but can be in any folder in the Documents.
-
mail_id
The email template ID needs to be obtained from the address bar when the email template is opened. The ID is 36 characters long, without slashes. If the variable is not passed, the email will not be sent.
-
email_send
The time to send the email with the file. It can take the following values:
onfinish - Send all emails after creating all files in the group (default)
oncreate - Send emails immediately after creating the file. When creating a single file, onfinish and oncreate are identical.
timeout - Send emails after a period of time. In this case, two more parameters need to be passed:
email_timeout_value - numeric value of the interval at which to send emails, integer value
email_timeout_value - the unit of measurement of the interval. Can take values "m" (minutes), "h" (hours), "d" (days).Or, to specify the exact time of sending, pass the time in unix time format in email_timeout_timestamp. If both variables are passed, the priority is with the latter. -
folder_id
Folder to add files to Drive. If the folder doesn't exist, it will be created automatically when creating the first file. The folder ID needs to be taken from the address bar when the folder is open. The ID is 36 characters long, without slashes.
-
page_id
If the document has multiple pages, the page_id field can be passed with the ordinal number (starting from 0), or the numbers (comma-separated) of the pages to be used for creating the file.
Thus, the form should have two required hidden fields. These are the Secure field.
Hidden field Secure. The value of the field should be taken from the settings.
And the doc_id field.
Hidden field doc_id. The value of the field is the document ID from the address bar.
Additionally, if it is necessary to send a file via email, the email ID must be specified.
Hidden field mail_id. The value of the field is the document ID from the address bar.
If the file needs to be added to a specific folder in Drive, the folder ID must be specified.
Hidden field folder_id. The value of the field is the document ID from the address bar.
Authentication
Authentication parameters determine who can use the form.
- No authentication. Any visitor can fill out the form. If the form includes fields like mask_email or mask_phone, this data will simply be saved with the file without verification.
-
By email. This type of authentication ensures that the entered email address belongs to the visitor by sending a one-time code to their address. If the code is not entered, the file will not be created.
For email-based authentication, the form must include a mask_name field with the "Required" switch turned on, or the form must be placed in the Personal Account.The "Sender" parameter allows specifying which Sender to use for sending the email with the one-time code.
List-based Authentication. When this parameter is enabled, not only ownership of the specified address is checked, but also the existence of this address in a separate table. This allows determining in advance the range of individuals authorized to use the form. To do this, click "Configure" directly below this parameter. In the opened window, select the table (or document with a table) where the list of addresses is stored, the column in which they are listed. The "Delete row" switch allows indicating whether to delete the row with this address from the table. Thus, the specified table will only contain addresses that have not yet been used for authentication.
-
By phone number. This type of authentication ensures that the phone number belongs to the visitor by sending a short call to the number. The visitor will need to enter the last 4 digits of the reverse number. If this is not done, the file will not be created.
For phone number-based authentication, the form must include a field with the name mask_name with the "Required" switch turned on.List-based Authentication. When this parameter is enabled, not only ownership of the specified phone number is checked, but also the presence of this number in a separate table. This allows determining in advance the range of individuals authorized to use the form. To do this, click "Configure" directly below this parameter. In the opened window, select the table (or document with a table) where the list of numbers is stored, the column in which they are listed. Numbers must be in an international format, without any characters, except for a "+" at the beginning of the number, for example - +71234567890. Unnecessary characters can be removed from the table using the "Find and Replace" Wordform tool. The "Delete row" switch allows indicating whether to delete the row with this number from the table. Thus, the specified table will only contain numbers that have not yet been used for authentication.
Allow creating only one file
If this setting is enabled, the visitor will be able to create only one file with the entered email address or phone number. When authentication is enabled, the visitor will need to confirm ownership of the specified address or number beforehand. When authentication is disabled, the visitor will simply need to enter a different address or number in order to use the widget again. Therefore, the most reliable way to prevent unauthorized multiple uses of the widget is authentication through a pre-specified list. If that is not possible, authentication via phone number helps reduce the number of repeated unauthorized creations through the widget.
Send file to yourself after creation
The file will be sent to the email address account immediately after creation. In the "Email template" field, you can choose which template to use for sending. In the Email Templates section, you can create a separate template for sending emails to the email account. If you write the %data variable in the email text, all file data will be added to that place in the form of a table.
Integration Parameters
- Allow requests to be accepted. If the switch is turned off, the form will not work.
- Domain on which the form is located. The form can only work when the site is open via https. In Tilda site settings, you can connect a free certificate and redirect from http to https.
- Accept requests only from the Personal Account. If the form is in the Tilda Personal Account, this switch should be enabled. If it is on the public part of the site, it should be disabled.
Other settings relate to placing the form in the Personal Account and are discussed below.
Form Operation
Now you just need to place the code on the page with the form. You need to copy the code from the integration page completely and paste it onto the necessary site pages. In Tilda, go to Page Settings - Additional - Code in HEAD and paste it there. Avoid pasting this code on all pages of the website, only on pages with forms. If it's necessary to allow the user to change their email, only the first line of the code (link) should be pasted on each Personal Account page. It will also be necessary to create an index page for the Personal Account.
Now you can open the published page and check the form's operation. A file will be created and displayed in a pop-up window for download. If this does not happen, check the website address in the integration parameters, as well as the correctness of secure and doc_id.
Using Data from the Personal Account
If the form is embedded in the Personal Account, you can use the user's name and address from their Personal Account.
To do this, you need to create a hidden field with the field name mask_name (or another corresponding name in the document), and specify ma_name as the value. In this case, the user's name will be automatically inserted into this field from the Personal Account.
Creating a File with One Button
The form can only contain one button, clicking on which can lead to the creation of a file without the need to fill in fields (for example, when the name is taken from the account data). Since Tilda cannot submit a form containing only hidden fields, it is necessary, for example, to create a checkbox for consent to data processing.
My Certificates
To display my certificates, you need to create a form in which, as indicated above, specify "Your script for data acceptance." Then add hidden fields secure and doc_id. Specify all as the value in the last field. When a visitor opens this page in the Personal Account, they will see a list of all certificates in place of the form with the ability to download them.