Engineering

Send New Crashes To Your Slack Using Countly

Last updateD on
October 27, 2023
Arturs Sosins
Arturs Sosins
CTO at Countly
Send New Crashes To Your Slack Using Countly

Countly has many powerful features, and one of them is Hooks. You can set up custom triggers and actions, and we want to expand it even further. But for now, let’s check some simple but powerful use cases you can implement. Notifying you in Slack about new crashes happening in your app.

Prerequisites

You need to have an app or a website integrated with Countly SDK and collect crash/error information from your app. If you don’t track crashes yet, check out the documentation for your SDK on how to enable tracking it.

You will also need a webhook URL from Slack to which to send data to. Go to Slack webhooks and follow the instructions. In the end, note down Slack webhook URL, we will going to need it later.

Setting up hook in Countly

You can find the Hooks section under the “wrench” icon on your Countly Dashboard.

Click on New Hook and fill out some basic information like the name of the hook, it’s description, and select for which app it should work, and click Next Step.

After clicking Next, fill out the trigger information. Select Internal Actions as Trigger type and /crashes/new as Internal action and click Next Step.

And as the last step, select Make an HTTP request, which will call Slack webhook. Provide Slack webhook URL in the URL to send the data to and select the method as POST (as it is the method that Slack webhook accepts).

Then as the requested body provides a Slack formatted message, you can use a simple message or go as fancy as you want with Slack's advanced message formatting.

To get data about the crash, you should use {data} placeholders. This is basically using data as the root object in curly brackets, like this: {data}

And then inside of it {data.user} references the user information according to app_users scheme, and {data.crash} references to crash information according to the app_crashgroups scheme, and app information is referenced through {data.app} according to the apps scheme.

So, for example:

  • If you want to access the application id, it would be {data.app._id}
  • If you want to access the user’s username, it would be {data.user.username}
  • If you want to access the crashes error stack trace, it would be {data.crash.error}

In the end, we can construct a message that looks something like this:

{

"text":"*New Error received*\nfor *{{data.user.name}}*\nApp Version: *{{data.crash.latest_version}}*\n at <https://yourcountlydomain/dashboard#/{{data.app._id}}/crashes/{{data.crash._id}}>\n```{{data.crash.error}}```"

}

After filling this all, you can test your hook and see if you receive a message with placeholders.

And that’s it. Every time a new crash, that has not happened before, will happen, it will notify you on Slack providing needed information and an actionable link to check the details more.

Conclusion

There are many things you can do with Hooks, and this was just one simple example of how you can utilize it to integrate it better into your workflow. But we are open to more suggestions. What other kinds of actions would you like to see in Countly? 

Let us know on our community discord: https://discord.gg/countly

About the Author

Arturs Sosins is the CTO at Countly, whose main goal is making Countly as robust and extendable as possible. In the spare time, when not spending time with his big family, Arturs enjoys game development, game design, and music-related projects..

Thank you! The Data Privacy Checklist will be in your inbox shortly.
Oops! Something went wrong while submitting the form.
TAGS
Countly
Crashes
Features
Slack

Subscribe to 🗞️
our newsletter

Join 10,000+ of your peers and receive top-notch data-related content right in your inbox.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Get started with Countly today 🚀

Elevate your user experience with Countly’s intuitive analytics solution.
Book your demo

Get started with Countly today 🚀

Elevate your user experience with Countly’s intuitive analytics solution.
Book your demo

More posts from Product Analytics