Skip to content

Use Iter8 to send a Slack message

Iter8 provides a slack task that can be used in a performance test to send a message to a Slack channel using a webhook.

Example

In this example, you will run the Your first performance test but at the end of the performance test, Iter8 will send a message on Slack.

The message will simply contain a summary of the performance test in text form. However, you can easily construct a more sophisticated message by providing your own payload template.

This task could provide important updates on a performance test over Slack, for example a summary at the end of the test.

To summarize what will happen, you will create a new channel on Slack and configure a webhook, set up and run a performance test, and check if a message was sent to the channel.

The slack task requires the URL of the Slack webhook. To see a full list of the github task parameters, see here.

  1. Create a new channel in your Slack organization.
  2. Create a Slack app, enable incoming webhooks, and create a new incoming webhook. See here.
  3. Ensure that you have a Kubernetes cluster and the kubectl CLI. You can create a local Kubernetes cluster using tools like Kind or Minikube.
  4. Install the Iter8 controller

    Iter8 can be installed and configured to watch resources either in a single namespace (namespace-scoped) or in the whole cluster (cluster-scoped).

    helm install --repo https://iter8-tools.github.io/iter8 --version 1.1 iter8 controller
    
    helm install --repo https://iter8-tools.github.io/iter8 --version 1.1 iter8 controller \
    --set clusterScoped=true
    

    For additional install options, see Iter8 Installation.

  5. Deploy the sample HTTP service in the Kubernetes cluster.

    kubectl create deploy httpbin --image=kennethreitz/httpbin --port=80
    kubectl expose deploy httpbin --port=80
    

  6. Launch the performance test with the slack task with the appropriate values.
    helm upgrade --install \
    --repo https://iter8-tools.github.io/iter8 --version 1.1 httpbin-test iter8 \
    --set "tasks={http,slack}" \
    --set http.url=http://httpbin.default/get \
    --set slack.url=<Slack webhook> \
    --set slack.method=POST
    
  7. Verify that the message has been sent after the performance test has completed.
Some variations and extensions of the slack task

The default slack task payload sends a summary of the performance test.

However, you do not need to use the default payload. You can provide your own payload by overriding the default of the payloadTemplateURL.

For example, you can also use Slack's Block Kit to create more sophisticated messages. You can use markdown, create different sections, or add interactivity, such as buttons.