Contents
Getting started
- Create your html form with the class form2channel
<form class="form2channel"> - Add a submit button
<button type="submit">Submit</button> - Add a link to our JS file on the form page
<script src="//form2channel.com/js/form2channel.js"></script> - Upload the page to your server
Hit F12 to see the result of the submission in the developer console.
Javascript Submit
If you want to validate the form or give users feedback on the status of their submission, you can submit the form using Javascript.
You need to call a function called form2channel like so
//You can pass any form into this function form2channel(form) .then(data => { //The service returns a Json object that consists of: //A message: data.Message //A success boolean: data.Success console.log(data.Message); });
Example form. We use this method on our contact us page
Slack setup
To create a Slack webhook
- Go to https://api.slack.com/apps
- Add an app to a workspace
- Activate "Incoming Webhooks"
- Select "Add new webhook to workspace" (bottom)
- Add a hidden input tag to your form. The name must be formto_slack and the value your Webhook URL
Telegram Setup
To get a Telegram ChatID
- Open this page on your phone and click the link
- Send /start to @Form2ChannelBot to get a ChatID
- Add a hidden input tag to your form. The name must be formto_telegram and the value your Chat ID
Http Info
Provide an http address that accepts a Json array of objects (key/value pairs). Example Json:[ {"key":"formto_email","value":"me@email.address"}, {"key":"FirstName","value":"John"}, {"key":"LastName","value":"Lennon"}, {"key":"Country","value":"United Kingdom"}, {"key":"Subscribed","value":"checked"}, {"key":"Gender","value":"Male"} ]
Post data directly to our REST API
You can skip the form altogether and submit your data directly to our API as a Json object
- Call our FormTo API
- URI: https://showcase.api.linx.twenty57.net/Form2Channel?PageUrl=[your unique page identifyer]
- Method: POST
- Content Type: application/json
- Body: Array of key / value pairs as shown below
[ {"key":"formto_email","value":"me@email.address"}, {"key":"FirstName","value":"John"}, {"key":"LastName","value":"Lennon"}, {"key":"Country","value":"United Kingdom"}, {"key":"Subscribed","value":"checked"}, {"key":"Gender","value":"Male"} ]