gitleads

1.0.2 • Public • Published

GitLeads

Handy module for generating leads from github and posting them to Slack or other areas.

Purpose

This module does two things:

  1. Reads user profile information from GitHub
  2. Post that information to Slack, if it meets certain basic requirements

Use Case

You are running a website. People sign up to your website. You want to know if these people work for companies that may bring additional business to your company.

You use GitLeads to programmatically query GitHub for their information, and post it to Slack for your team to see, if it turns out to be interesting.

If there is interest / I have time, more endpoints will be added—i.e. email, write to file, etc.

Installation

npm i gitleads

Usage in Code


    const GitLeads = require('gitleads');

    const SlackURL = 'your_slack_url_here';

    var id = 'TedYav';
    var email = 'hello@TedY.io';

    GitLeads.lookup(id,email)
    .then(function(lead){
        return lead.postToSlack({url: SlackURL});
    })
    .then(function(){
        console.log('That was easy!');
    })
    .catch(function(err){
        console.log('Something went wrong:');
        console.log(err);
    });

Note: it is important to include catch at the end of the promise chain. If no user is found on GitHub for the id and email provided, or if the configuration for Slack is incorrect, an error will be thrown.

Options

postToSlack takes an object containing options as follows:

url: url for slack's REST API including your key. If not provided, defaults to environment variable SLACK_URL. If that is undefined, an error will be thrown.

channel: channel to post to on slack. Defaults to '#slacktest'

botName: bot name to post to on slack. Defaults to 'github-signup'

botIcon: bot icon to use on slack. Defaults to ':octocat:'

missingLimit: number of 'important' fields that can be missing, before the lead is not posted to slack. Defaults to 5.

importantFields: fields which are considered 'important' by your organization. If more than missingLimit are missing from a user's Github Profile, then the lead will not post to slack. Defaults to: ['company', 'email', 'blog', 'organizations', 'location']

Example:


options = {
    url: 'slack_api_url',
    channel : '#slack-leads',
    botName : 'github-signup-bot',
    botIcon : ':octocat:',
    missingLimit : 3, 
    importantFields : ['company', 'email', 'blog', 'followers']
}

Any field of this object which is left blank will have a default value chosen as specified.

Usage by CLI

If you want to run the script by hand, or test it out with a dummy server, there is a CLI interface.

Type this into your shell and follow the instructions:

npm i gitleads && cd node_modules/gitleads && node CLI/gitLeadsCLI.js

Extensions

Additional outputs will be added as I have time to develop them.

Readme

Keywords

none

Package Sidebar

Install

npm i gitleads

Weekly Downloads

0

Version

1.0.2

License

ISC

Last publish

Collaborators

  • tedyav