Contents
Getting started
- Create an html form in your favourite html editor
<form class="form2channel"> - 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
- Register your page with us
The form2channel.js file adds an event listener for the submit event of all forms that have the form2channel
class.
When a form with the class form2channel
is submitted, the event listener calls an async function called form2channel
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); });
Check out an example form or check out how 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)
- Use the Webhook URL to register your page with us
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
- Use the ChatID to register your page with us
Http Info
Provide an http address that accepts a Json array of objects (key/value pairs). Example Json:[ {"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
- Signup to Form2Channel
- Register a page (enter any unique identifyer in the PageUrl field)
- 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":"FirstName","value":"John"}, {"key":"LastName","value":"Lennon"}, {"key":"Country","value":"United Kingdom"}, {"key":"Subscribed","value":"checked"}, {"key":"Gender","value":"Male"} ]