Skip to content

Node.js module to auto invite Typeform submissions to Slack

Notifications You must be signed in to change notification settings

drawbit/SlackForm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SlackForm by lucasjgordon

SlackForm is a node module that will allow you to automatically invite new Typeform submissions to your Slack community.

Basic Usage

Add SlackForm.js to your project, run npm install. Include the module using:

var SlackForm = require('./SlackForm.js');

Now you need to get your keys. You'll need you Typeform API Key and the name of your Slack group as it is shown in the group's url. Create a new Slack token here. You'll need your Typeform ID, which can be obtained from the URL of the actual form - it will look something like this "bU6FKI".

Finally, you need to know the name of the email field in the Typeform JSON response. Create a URL like this:

https://api.typeform.com/v0/form/TYPEFORM_ID?key=TYPEFORM_API_KEY&completed=true&limit=1

Load it, and in the questions array find the form entry that asks for the user's email address. You need the id of the email field, it should look something like this "email_4202153".

Initialise SlackForm like this:

var slackForm = new SlackForm({
	typeformApiKey: '<TYPEFORM_API_KEY>',
	typeformId: '<TYPEFORM_ID>',
	typeformEmail: '<TYPEFORM_EMAIL_ID>',
	slackChannel: '<SLACK_GROUP_NAME>',
	slackToken: '<SLACK_TOKEN>'
});

Public Methods

###Invite This method sends invites to all email addresses from Typeform submissions within the last hour. It returns an array of responses from each invite request. Set up a cron job to run the script every hour.

slackForm.invite(function (err, data) {
	if (err) {
		throw err;
	}

	console.log(data);
});

About

Node.js module to auto invite Typeform submissions to Slack

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%