diff --git a/src/Slack.php b/src/Slack.php
index 5024d9c..acb6a2c 100644
--- a/src/Slack.php
+++ b/src/Slack.php
@@ -63,7 +63,7 @@ class Slack {
     $webhook_url = $config->get('slack_webhook_url');
 
     if (empty($webhook_url)) {
-      $this->messenger()->addError($this->t('You need to enter a webhook!'));
+      \Drupal::messenger()->addError($this->t('You need to enter a webhook!'));
       return FALSE;
     }
 
