function main()

in apis/slack-invite.js [27:57]


function main({email, org, slacktoken}) {
  return request(
    'post',
    `https://${org}.slack.com/api/users.admin.invite`,
    {
      email: email,
      token: slacktoken,
      set_active: true
    },
    options
  )
  .then(res => {
    if (res.statusCode == 200 && res.body.ok) {
      return {
        body: { message:`Success! Check ${email} for an invite from Slack.` }
      }
    } else {
      return {
        statusCode: 400,
        body: { error: res.body }
      }
    }
  })
  .catch(err => {
    console.error(err)
     return ({
       statusCode: 400,
       body: { error: err.message }
    })
  })
}