This Cloud Run service written in nodejs receives Sauce Labs webhooks, and converts and sends them to a Slack Incoming Webhook URL.
The instructions below takes you through creating the Slack Incoming Webhook, deploying the service to Google Cloud, and hooking it up with Sauce Labs' webhook mechanism.
- Create a Slack Incoming Webhook
- Build and deploy the service to Google Cloud
- Integrate with Sauce Labs Webhook
- Add apps (under Apps at bottom)
- Search 'Incoming Webhooks'
- Click Add under 'Incoming Webhooks' under Available Apps
- Click 'Add to Slack'
- Select a channel
- Click 'Add Incoming Webhooks integration'
- Note the Webhook URL =
slack_webhook_url
- install gcloud - https://cloud.google.com/sdk/docs/install
- gcloud init - https://cloud.google.com/sdk/docs/initializing
- gcloud auth login
- gcloud projects create
PROJECT_ID
- https://cloud.google.com/resource-manager/docs/creating-managing-projects - gcloud config set project
PROJECT_ID
- npm install Deploy a Node.js service to Cloud Run
- gcloud run deploy
- Note the Service URL =
serviceURL
- Login to Sauce Labs https://accounts.saucelabs.com/
- Go to https://app.saucelabs.com/integrations
- Enable Webhooks
- Set the WEBHOOK URL to
serviceURL
?slack_webhook=slack_webhook_url
- Select 'All Tests' for both Virtual Devices and Real Devices
- Save
- Run some tests and watch the Slack channel for notifications
A Slack app is required to use the Slack API to search messages in a channel
- https://api.slack.com/methods/search.messages
- https://api.slack.com/apps
- Click 'Create New App'
- From Scratch
- App Name = Sauce Slack Webhook
- Select workspace
- Click 'Permissions'
- Under 'User Token Scopes', click 'Add an OAuth Scope'
- Select 'search:read'
- Scroll up and click 'Install to Workspace'
- Click 'Allow'
- In Slack, invite this Slack App into the channel associated with the Slack Webhook
SLACK_WEBHOOK_URL
- from Step 1 aboveSLACK_APP_TOKEN
- retrieve from the 'Install App' under 'Settings'
- npm start
In separate terminal,
- npm test