Get number of NUnit failed tests so I can send a Slack notification about it

I am wondering if its possible to get the testResultsSummary in my Jenkinsfile? Like I would like to do something like this

env.testResultsSummary = nunit testResultsPattern: 'test-results.xml', failedTestsFailBuild: true, failIfNoResults: true

and then send env.testResultsSummary.getFailCount() to users in Slack. It doesn’t seem possible to do this but is there an alternative?