https://github.com/switcherapi/switcher-slash-webhook
Switcher Slash Webhook is a simple API wrapper written in Ruby using Sinatra
https://github.com/switcherapi/switcher-slash-webhook
Last synced: 10 months ago
JSON representation
Switcher Slash Webhook is a simple API wrapper written in Ruby using Sinatra
- Host: GitHub
- URL: https://github.com/switcherapi/switcher-slash-webhook
- Owner: switcherapi
- License: mit
- Created: 2020-03-22T23:51:04.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2025-03-13T07:48:39.000Z (11 months ago)
- Last Synced: 2025-03-29T21:41:26.408Z (11 months ago)
- Language: Ruby
- Homepage:
- Size: 90.8 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
***
Switcher Slash Webhook
A Slash Add-on App for Slack
[](https://github.com/switcherapi/switcher-slash-webhook/actions/workflows/master.yml)
[](https://coveralls.io/github/switcherapi/switcher-slash-webhook?branch=master)
[](https://opensource.org/licenses/MIT)
[](https://switcher-hq.slack.com/)
***

# Requirements
- Ruby (Sinatra) 1.3 (Release 2.2.x)
- Slash add-on for Slack
- Coffee =D
# About
**Switcher Slash Webhook** is a API wrapper used to check both Switcher Load Balance and Switcher API from the Slack app using Slash Command add-on.
# Installing/Running
### Setup the environment
Changes on *config/development.yaml* file.
```
slack_hook_endpoint: [SLACK_HOOK_URL]
slack_hook_token: [SLACK_API_KEY]
switcher_load_balance: https://switcher-load-balance.herokuapp.com
switcher_api_key: [SWITCHER_COMPONENT_KEY]
switcher_api_domain: [SWITCHER_DOMAIN_NAME]
```
### Running
> bundle install
> rackup -p 4567
### Testing
> rspec
* * *
# Usage
### Request - status (GET)
```
{{url}}/cmd?token=SLASH_CMD_TOKEN&text=status
```
### Response
```json
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Switcher Load Balance\n\n*Message:* All good\n*Code:* 200\n"
},
"accessory": {
"type": "image",
"image_url": "https://raw.githubusercontent.com/s/switcherapi-assets/master/logo/switcher_mark_grey.png",
"alt_text": "Switcher API"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Node:* SNODE1 :sunny:\n*Endpoint:* https://switcher-api.herokuapp.com\n*Status:* online"
}
}
]
}
```

### Request - check API (GET)
```
{{url}}/cmd?token=SLASH_CMD_TOKEN&text=check-prd+FEATURE01+-v+Roger
```
### Response
```json
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Switcher API\n\n*Result:* Passed\n*Reason:* Success\n"
},
"accessory": {
"type": "image",
"image_url": "https://raw.githubusercontent.com/switcherapi/switcherapi-assets/master/logo/switcher_mark_grey.png",
"alt_text": "Switcher API"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Command:* /cmd check-prd FEATURE01 -v Roger"
}
}
]
}
```

# Contributing
Please do open an issue or PR if you feel you have something cool to add.