package
0.0.0-20200304162828-e34edbc7894d
Repository: https://github.com/rickt/gsuitemdm.git
Documentation: pkg.go.dev

# README

gsuitemdm Cloud Function slackdirectory

A cloud Function component of the gsuitemdm package that can be used to search for a phone number using name or email as a search key. This cloud function is very similar to directory but is specifically designed to format output as expected by Slack, and as such slackdirectory should be used as an HTTP backend for a Slack /slash command such as /dir or /phone (etc).

This can be very useful for orgs whose staff all use G Suite MDM'd mobile devices. With slackdirectory you have an always up-to-date, automatically-updated company mobile phone directory available to anyone in your org's Slack with /phone <name>.

HOW-TO Setup the Slack /phone slash command

Docs coming soon.

HOW-TO Configure slackdirectory

slackdirectory uses a .yaml file containing several environment variables the cloud function reads during app startup. These environment variables point the app to the shared master cloud function configuration, as well as the expected token to be received in each request from Slack, that are stored as Secret Manager secrets. An example .yaml file for slackdirectory:

APPNAME: slackdirectory
SM_APIKEY_ID: projects/12334567890/secrets/gsuitemdm_apikey
SM_SLACKTOKEN_ID: projects/12334567890/secrets/gsuitemdm_slacktoken

HOW-TO Deploy slackdirectory

$ gcloud functions deploy SlackDirectory \
  --runtime go111 \
  --trigger-http \
  --env-vars-file env_slackdirectory.yaml

HOW-TO Use slackdirectory

API

Example test command line that searches for phone numbers including the name "doe" and returns the output correctly formatted for display in Slack:

$ curl -X POST -d "token=0123456789&text=doe" \ 
  https://us-central1-<YOURGCPPROJECTNAME>.cloudfunctions.net/SlackDirectory
Users matching "doe": (2)
Jane Doe: :dir_phone: (213) 555-1313 :dir_email: `[email protected]`
John Doe: :dir_phone: (213) 555-1212 :dir_email: `[email protected]`