SlackBot for MintPress
The SlackBot for MintPress provides a set of APIs that support the /mintpress slash command and associated Slack interactions (approvals and dialog actions).
Usage
Please see the following for usage instructions for the MintPress SlackBot Slash command.
Example: /mintpress summary
Present a summary of service catalog instances. All instances or limited to a particular environment.
/mintpress summary
description:
summary - list summary of all catalog item instances
parameters:
none
example:
/mintpress summary
Example: /mintpress status
Obtain status details on a service catalog instance, including any registered console URLs
/mintpress status [ uuid | <provider_code> <environment_code> <item_code> ]
description:
status - list status of a specific catalog item instance
parameters:
uuid - the uuid of the catalog item
OR
provider_code - the provider_code of the catalog item
environment_code - the environment_code of the catalog item
item_code - the item_code of the catalog item
example:
/mintpress status 092f83dd-b804-44ac-9723-9c501e3b5a4e
/mintpress status vmware-vsphere itvsp350 OSI
Example: /mintpress launch
Launch a new Service Catalog item instance into an environment
/mintpress launch <provider_code> <environment_code> <item_code>
description:
launch - launch a new catalog item instance
note: a dialog will pop up to prompt you for inputs
parameters:
provider_code - the provider_code of the catalog item
environment_code - the environment_code of the catalog item
item_code - the item_code of the catalog item
example:
/mintpress launch <enter inputs as prompted>
Example: /mintpress action
Perform an action on a Service Catalog instance (e.g. shutdown, restart, destroy) Note: Allowed actions can be limited by setting action_list
in the ~/.slack/config
file.
/mintpress action <uuid> <action>
description:
action - perform action on a new catalog item instance
note: a dialog will pop up to prompt you for inputs
parameters:
uuid - the uuid of the catalog item
action - the action to perform on the catalog item
example:
/mintpress action <enter inputs as prompted>
Example: /mintpress node
Obtain a list of nodes registered with MintPress or show details for a particular node.
/mintpress node [ list | show <node> ]
description:
node list - show list of all nodes registered with MintPress
node show <node> - show details of a node registered with MintPress
example:
/mintpress node list
/mintpress node show foo.mintpress.io
Example: /mintpress environment
Obtain a list of environments registered with MintPress or show details for a particular environment.
/mintpress environment [ list | show <env> ]
description:
environment list - show list of all environments registered with MintPress
environment show <env> - show details of an environment registered with MintPress
example:
/mintpress environment list
/mintpress environment show test
Installation Instructions
Create Slack Application
Create a new Slack App as per [url]https://www.slack.com
Add Slash Command (/mintpress
)
Add slash command for /mintpress
Add Interactive Commands
Add approve/reject interactive commands
Obtain the associated metadata from the Slack Application
Config: ~/.mintpress/config
Create a new file (~/.mintpress/config
) in the home directory of the MintPress SlackBot user. This file contains connection details for the MintPress Console
Example: MintPress Config File
[default]
api_url = https://dev.mintpress.io:8443
api_username = mintpress
api_password = mintpress
[profile dev]
api_url = https://dev.mintpress.io:8443
api_username = mintpress
api_password = mintpress
[profile test]
api_url = https://test.mintpress.io:8443
api_username = mintpress
api_password = mintpress
[profile prod]
api_url = https://prod.mintpress.io:8443
api_username = mintpress
api_password = mintpress
Config: ~/.slack/config
Create a new file (~/.slack/config
) in the home directory of the MintPress SlackBot user. This file contains details of the Slack Application
Example: Slack Config File
[default]
api_url = https://slack.com/api
app_id = ABCDEFGH012
client_id = 1234567890123.1234567890123
client_secret = a123b456c789d123e456f789
signing_secret = a123b456c789d123e456f789
verification_token = a123b456c789d123e456f789
oauth_access_token = xoxp-12345678901-12345678901-12345678901-a123b456c789d123e456f789
bot_user_oauth_access_token = xoxb-12345678901-12345678901-12345678901-a123b456c789d123e456f789
api_token = xoxb-12345678901-12345678901-12345678901-a123b456c789d123e456f789
admin_users = adminuser1,adminuser2
approval_channel = mintpress-slackbot-approvals
privileged_actions = provision,destroy,patch
action_list = provision,destroy,start,stop,patch
[profile dev]
api_url = https://slack.com/api
app_id = ABCDEFGH012
client_id = 1234567890123.1234567890123
client_secret = a123b456c789d123e456f789
signing_secret = a123b456c789d123e456f789
verification_token = a123b456c789d123e456f789
oauth_access_token = xoxp-12345678901-12345678901-12345678901-a123b456c789d123e456f789
bot_user_oauth_access_token = xoxb-12345678901-12345678901-12345678901-a123b456c789d123e456f789
api_token = xoxb-12345678901-12345678901-12345678901-a123b456c789d123e456f789
admin_users = adminuser1,adminuser2
approval_channel = mintpress-slackbot-approvals
privileged_actions = provision,destroy,patch
action_list = provision,destroy,start,stop,patch
[profile test]
api_url = https://slack.com/api
app_id = ABCDEFGH012
client_id = 1234567890123.1234567890123
client_secret = a123b456c789d123e456f789
signing_secret = a123b456c789d123e456f789
verification_token = a123b456c789d123e456f789
oauth_access_token = xoxp-12345678901-12345678901-12345678901-a123b456c789d123e456f789
bot_user_oauth_access_token = xoxb-12345678901-12345678901-12345678901-a123b456c789d123e456f789
api_token = xoxb-12345678901-12345678901-12345678901-a123b456c789d123e456f789
admin_users = adminuser1,adminuser2
approval_channel = mintpress-slackbot-approvals
privileged_actions = provision,destroy,patch
action_list = provision,destroy,start,stop,patch
Start MintPress SlackBot
MintPress SlackBot provides a set of APIs that support the Slack slash command and Slack interactions.
ruby ./app/webapp.rb
The above will start a WEBrick process listening on port 9494 by default.
For testing, use ngrok to start a new ngrok process and update your slack endpoints to the new NGROK endpoints
ngrok http 9494
Update your slack API endpoints to use the new NGROK endpoints.
Login to your Slack and test out your /mintpress
slash commands.
Licence
# MintPress® - Automation and Configuration Management Platform
#
# Copyright © 2019 LimePoint. All rights reserved.
#
# This program and its contents are confidential and owned by LimePoint.
# Only licenced users are permitted to access and use of this file.
# This program (or any part of it) may not be disclosed, copied or used
# except as expressly permitted in LimePoint’s End User Licence Agreement.
#
# LimePoint® and MintPress® are Registered Trademarks of LimePoint
# For more information contact LimePoint at http://www.limepoint.com
License & Authors
-
Author:: LimePoint (support@limepoint.com)