When using the HTTP connector, data is sent as application/x-www-form-urlencoded data. The HTTP connector currently cannot pass data as JSON content, only as form encoded data.
This connector is particularly useful in two different cases:
- You need to use a third-party service that normally takes its inputs from a web form. Perhaps you're replacing the form and need to maintain the existing process, or maybe you're just adding another process to your work flow. FormAssembly will act as the "middleman," processing your form and delivering all its advanced features, and then forwarding the data to the remote script.
- You need to enforce some sort of validation on your form data that isn't provided by FormAssembly. Using a custom-built script, you could take the submitted data, check it against your own validation rules, and if needed, prevent the submission and redirect the respondent to the form with the appropriate error message.
When referencing the HTTP connector within scripts, we require following best-practices and using these standard ports:
-HTTP = tcp/80
-HTTPS = tcp/443
Remote Script & Authentication
Provide the address (URL) of the script that will process the data. If needed, you can also enter a username and password (RFC 2617 Basic HTTP Authentication).
The success of the remote script execution is determined by the HTTP Status code returned. At this time, HTTP 2xx codes (200 to 206) are considered success, and HTTP 4xx and 5xx are considered failures. Other status codes, such as 3xx redirects, are ignored.
Finding the remote script URL will be different depending on where you are attempting to send data. In general, you'll want to visit the destination website (i.e. where you are trying to send the data), right click on the form or data entry portion of that page, and click view source.
Next, you'll want to use your browser's Find command (usually ctrl+f or cmd+f) and search for "action=" without the quotation marks.
Once you've found that, you'll want to copy the value that is after the equals sign, and use that as your remote script URL. If you run into any trouble with this, please contact our support team and we'll be happy to help!
The purpose of the field mapping process is to specify what information should be sent and how it should be identified.
The HTTP Connector lists the fields present in your form with their default field name. You can edit the field names to match the names expected by your remote script. You can also enter additional fields with fixed values as needed.
Use of the HTTP POST option will submit your mapped data as if the data were from a webform containing the form fields defined in your mappings.
The HTTP GET option will submit your mapped data as URL encoded key-value pairs such as http://www.google.com?q=Johnson, assuming your Remote Script URL was http://www.google.com and you had mapped the Last Name field to a field name of q.
The connector's activity log is particularly useful to troubleshoot configuration problems with your connector.
To access it, go to the Connectors page for the desired form and click on log link for the HTTP Connector.
Create an Attachment from a Response
If you're connecting to a remote service that is designed to return a downloadable file, such as a PDF, the HTTP Connector will automatically save this file and attach it to your response.
You may access the file using the aliases listed below in your FormAssembly configuration, wherever formulas/aliases are supported.
To use these aliases in the Thank You page or to pass them to Salesforce, the HTTP Connector must be enabled.
Link to Download File
%%HTTP_CONNECTOR_ATTACHMENT_URL%%(with FormAssembly login)
%%HTTP_CONNECTOR_ATTACHMENT_UNPROTECTED_URL%%(unprotected, without FormAssembly login)
POST Response Alias
Submit Mode will create the formula alias
%%TFA_POST%%containing the remote script's response.
The full content of the response (including any HTML markup) can be accessed with formulas using the alias
We have 2 examples setups you can take a look at, and also some templates!