# Generate notifications, using Cycloid events as example
Most of our customers ask to send notifications for pipeline status on Slack, Github, etc.
The best approach to sending notifications is to use resources. Pipelines are flexible, and resources can add many functionalities. You can integrate any notification type by using existing resource (opens new window) or by creating your own (opens new window).
Let's use Cycloid events as example of notification.
Before using events, we advise you to
- Create a Cycloid API key with
all actionsfor testing purposes.
- Put the API key inside a Cycloid credential to be able to use it easily inside the pipeline.
Create a dedicated custom credential type called
custom_cyclobot-api-key containing a field
key like this:
This should produce a Vault credential with
custom_cyclobot-api-key.key as the path and key to access it.
Also, and you might already know the next step, if we want to keep our pipeline generic, we must define a new variable for the API key before using it in our pipeline:
Follow those steps to apply all changes described in this step
# Cycloid events configuration api_key: ((custom_cyclobot-api-key.key)) api_url: https://http-api.cycloid.io
At this point, we are ready to configure a new
cycloid-events resource in the pipeline and use it in our job:
resource_types: ... - name: cycloid-events type: docker-image source: repository: cycloid/cycloid-events-resource resources: ... - name: cycloid-events type: cycloid-events source: api_key: ((api_key)) api_url: ((api_url)) icon: fa-code-branch organization: ((customer)) severity: info type: Custom tags: - key: project value: ((project)) - key: env value: ((env)) - key: customer value: ((customer)) jobs: ... - name: functional-tests plan: - do: ... on_failure: do: - put: cycloid-events params: severity: crit message: Oops title: The deployment of ((project)) owl have failed on ((env)) environment on_success: do: - put: cycloid-events params: message: Congrats ! title: Successful deployment of ((project)) owl on ((env)) environment
First, define a new type of resource,
cycloid-events, and configure it in the
resources section. Finally, add a pipeline step hook (opens new window) for success and failure, which call the
Add and commit those changes in Git:
git add . git commit -m "Step 7" git push origin stacks
Get back to Cycloid's dashboard, and click on the
Refresh pipeline button .
After running the pipeline, a new Cycloid event should be visible on the event view: