Sending Neo4j messages to a Slack channel
Although not specific to Neo4j and this knowledge base document is provided as a convenience, if your environment has a Slack implementation, then Slack provides an API to allow you to programmatically send messags to a specific channel. This can be helpful, for example to send a message on success/failure of backup by checking the exit code of backup.
Using the Slack Hello World
example as a starting template, one will be
guided through the process of creating a Slack app and resultant WEBHOOK_URL to post messages to.
For example on backup failure:
$ curl -X POST -H 'Content-type: application/json' --data '{"text":"Backup Failure"}' YOUR_WEBHOOK_URL
replacing YOUR_WEBHOOK_URL with its actual value, for example the following code on a linux implementations
host=`uname -n`
time=`date`
msg="{ \"text\": \"Backup failure on $host at $time\" }"
curl -X POST -H 'Content-type: application/json' --data "$msg" https://hooks.slack.com/services/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
will result in a message to your Slack channel similar to
Is this page helpful?