Form2Channel Docs

Contents


Getting started

  1. Create an html form in your favourite html editor
    <form class="form2channel">
  2. Add a link to our JS file on the form page
    <script src="//form2channel.com/js/form2channel.js"></script>
  3. Upload the page to your server
  4. 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.

Check out an example form


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

  1. Go to https://api.slack.com/apps
  2. Add an app to a workspace
  3. Activate "Incoming Webhooks"
  4. Select "Add new webhook to workspace" (bottom)
  5. Use the Webhook URL to register your page with us
Slack Docs: https://api.slack.com/start/overview#creating

Telegram Setup

To get a Telegram ChatID

  1. Open this page on your phone and click the link
  2. Send /start to @Form2ChannelBot to get a ChatID
  3. 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

  1. Signup to Form2Channel
  2. Register a page (enter any unique identifyer in the PageUrl field)
  3. 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"}
          ]