You can add a title and description to your form to create context for your users.
Once your trigger is activated, you can press the 'View Form' button to be taken to the live, public endpoint for your form. This form can be shared with others you want to use your form.
Form Descriptions support markdown!
In order to add an input, press + Add a Form Element. You can add as many form elements as you want.
There are four input types you can currently choose from:
Title - There are a few different parts of the element to notice. First, you can create a title for the input (in the example image we are asking 'What is your name?'.
Required - You can set required to On/Off - if on, a user is required to enter an answer before they can submit the form.
Placeholder - This is just placeholder text you can enter for the text input.
The Text Area element behaves identically to the Text Input element. The key difference is it provides space for a longer form answer.
The Selector element can be used to give users of the form a set of choices to choose from. In order to add options to your selector, press the + Add an Option button. You can add as many options as you want.
The Radio element behaves exactly like the Selector element above. The form will render the options as radio buttons.
The File Upload element allows users to attach and upload a file when submitting your form. You can currently upload PDFs but more general file type support is coming soon.
The File Upload element will output a Struct of the following form:
File = {filename : String,bytes : Bytes,extension : String,mimetype : String,}
CSS - You can customize the CSS of your form for your own look and feel.
In order to view your live form, make sure your trigger is active and then press the View Form button.
When setting up the Form Trigger, you can create as many named endpoints as you like. If you don't provide a name for your endpoint, the trigger will match the root URL. All endpoint names must be unique throughout your script to prevent ambiguity.
To access your endpoints, use the program ID as a subdomain of wayscript.io. For example, in the image above, you can trigger your script by hitting either https://16233.wayscript.io/ or https://16233.wayscript.io/custom_endpoint.
Remember to activate your trigger before using the endpoint!
If you would like your form to require a login to view, enable the "Password Protection" toggle.
A button to "Manage Login Credentials" will appear.
Clicking this button will take you to "Login Credentials" section of the "Script Setup" tab, where you can manage the usernames and passwords that will allow people to log in to your endpoints.
When you click "Add a credential," a new login will be automatically generated for you, including a username and randomly-generated password. You can choose to use these values, or edit them as you see fit.
When a user goes to access your form for the first time, they will now be prompted to login.
The username information of each trigger run will be available in the system global struct , context.
If you password-protect your endpoints, you can use the credentials added above to access your endpoints by including an Authorization: Basic
header in your request.
This header should follow the standard for HTTP basic access authentication. For example, suppose your Username is "[email protected]" and your Password is "letmein," you would create the Authorization header by:
Joining the Username and Password into a single string, separated by a semicolon: [email protected]:letmein
Encoding that string in Base64: Y2FwdGFpbkB3YXlzY3JpcHQuY29tOmxldG1laW4=
Passing that encoded string to your custom endpoint by including the Authorization: Basic Y2FwdGFpbkB3YXlzY3JpcHQuY29tOmxldG1laW4=
header in your request.
These headers are also displayed for you under each password in the "Login Credentials" section of the "Script Setup" tab.
If your endpoint is not public, you can also use your WayScript API Key to access your endpoints api call by including an Authorization: Bearer
header in your request.
For example, if your WayScript API Key is fhAEdGT9EbFDh_migcrukZ1Vb28rLFKqt9AxOiq9bdQ
, you would include the Authorization: Bearer fhAEdGT9EbFDh_migcrukZ1Vb28rLFKqt9AxOiq9bdQ
header in your request.
The Form Trigger will output a Struct of the responses to your form.
Form = {input_1 = 'Answer One',input_2 = 'Answer Two',...}
The raw form data submitted to the Form Trigger endpoint.