# Jenkins slack plugin: response 400 - but "test connection" works ok

**URL:** <https://community.jenkins.io/t/jenkins-slack-plugin-response-400-but-test-connection-works-ok/8339>\
**Category:** Using Jenkins\
**Created:** [July 6, 2023, 10:46am UTC](https://community.jenkins.io/t/jenkins-slack-plugin-response-400-but-test-connection-works-ok/8339 "2023-07-06T10:46:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vkatsikaros](https://avatars.discourse-cdn.com/v4/letter/v/a87d85/32.png) [@vkatsikaros](https://community.jenkins.io/u/vkatsikaros)\
**Post date:** [July 6, 2023, 10:46am UTC](https://community.jenkins.io/t/jenkins-slack-plugin-response-400-but-test-connection-works-ok/8339/1 "2023-07-06T10:46:36Z")

</div>

Hi

I am trying to send slack notifications from jenkins. I installed the most recent version of the `slack` plugin. My (related) configuration as code is

```auto
credentials:
  system:
    domainCredentials:
    - credentials:
      - string:
          description: "Adzuna Slack Token"
          id: "slack-token"
          scope: GLOBAL
          secret: "{foo}"
jenkins:
  crumbIssuer: "strict"
unclassified:
  slackNotifier:
    botUser: false
    sendAsText: false
    teamDomain: "team-foo"
    tokenCredentialId: "slack-token"

```

I tested through “Dashboard → Manage Jenkins → System → Slack → Test connection”. It says “success” and it does send a message to slack

However, from my pipeline console output says

```auto
...
Slack Send Pipeline step running, values are - baseUrl: <empty>, teamDomain: team-foo, channel: null, color: danger, botUser: false, tokenCredentialId: slack-token, notifyCommitters: false, iconEmoji: <empty>, username: <empty>, timestamp: <empty>
ERROR: Slack notification failed. See Jenkins logs for details.
...

```

and jenkis logs say:

```auto
Jul 06 10:32:20 jenkins-controller jenkins[3259]: 2023-07-06 10:32:20.599+0000 [id=3008] WARNING j.p.slack.StandardSlackService#postToSlack: Slack post may have failed. Response: null
Jul 06 10:32:20 jenkins-controller jenkins[3259]: 2023-07-06 10:32:20.600+0000 [id=3008] WARNING j.p.slack.StandardSlackService#postToSlack: Response Code: 400

```

Any ideas would be helpful. Let me know if I can provide more info

PS without the [Strict Crumb Issuer Plugin](https://plugins.jenkins.io/strict-crumb-issuer) I was getting a warning and a 403. So I followed the instructions in the log file ([Improved CSRF protection link](https://www.jenkins.io/redirect/crumb-cannot-be-used-for-script)), and installed it with the default configuration, Hope this wasn’t a red herring.

```auto
Jul 06 10:30:45 jenkins-controller jenkins[3259]: 2023-07-06 10:30:45.565+0000 [id=475] INFO o.j.p.s.StrictCrumbIssuer#validateCrumb: Invalid crumb found in the request
Jul 06 10:30:45 jenkins-controller jenkins[3259]: 2023-07-06 10:30:45.566+0000 [id=475] WARNING hudson.security.csrf.CrumbFilter#doFilter: Found invalid crumb 2c346e60bc7344ddbe137e316e3df8b8e7c0dadaf63dfe3aa6b769c330dcb067. If you are calling this URL with a script, please use the API Token instead. More information: https://www.jenkins.io/redirect/crumb-cannot-be-used-for-script
Jul 06 10:30:45 jenkins-controller jenkins[3259]: 2023-07-06 10:30:45.568+0000 [id=475] WARNING hudson.security.csrf.CrumbFilter#doFilter: No valid crumb was included in request for /ajaxExecutors by adzuna. Returning 403.

```

---

<div class="post-metadata">

**Author:** ![vkatsikaros](https://avatars.discourse-cdn.com/v4/letter/v/a87d85/32.png) [@vkatsikaros](https://community.jenkins.io/u/vkatsikaros)\
**Post date:** [July 8, 2023, 9:30am UTC](https://community.jenkins.io/t/jenkins-slack-plugin-response-400-but-test-connection-works-ok/8339/2 "2023-07-08T09:30:02Z")

</div>

Forgot to mention I use

- Jenkins 2.401.2
- slack plugin Version 664.vc9a\_90f8b\_c24a\_ (I understand this is the latest)

Clarification: I saw this [Slack response code 400, message null, when using blocks · Issue #623 · jenkinsci/slack-plugin · GitHub](https://github.com/jenkinsci/slack-plugin/issues/623)

- I don’t have `blocks` in my jenkinsfile a
- I am using the `jenkins-ci` slack app

The [installation instructions](https://github.com/jenkinsci/slack-plugin/issues/623) say that I should be using the `jenkins-ci` slack app, but I can also use another slack app? I am unsure

I also increased the log verbosity. I got this at the logs (but it doesn’t reveal anything to me at least)

```auto
Jul 08, 2023 10:09:16 AM FINE jenkins.plugins.slack.StandardSlackService
Posting: to null on foo: {"attachments":[{"fallback":"Build failed - 2 in repo_foo/branch_foo (<http://jenkins-controller.example.com/job/repo_foo/job/branch_foo/2/|Open>)","color":"danger","fields":[{"short":false,"value":"Build failed - 2 in repo_foo/branch_foo (<http://jenkins-controller.example.com/job/repo_foo/job/branch_foo/2/|Open>)"}],"mrkdwn_in":["pretext","text","fields"]}],"link_names":"1","unfurl_links":"true","unfurl_media":"true","channel":"null","as_user":"true"}

Jul 08, 2023 10:09:16 AM WARNING jenkins.plugins.slack.StandardSlackService postToSlack
Slack post may have failed. Response: null

Jul 08, 2023 10:09:16 AM WARNING jenkins.plugins.slack.StandardSlackService postToSlack
Response Code: 400

```

Moreover, testing the slack connection through the web UI still works

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/jenkins/original/2X/6/6e4c02d53dd6582ae92af8bb3c27a59e8665b5c3.png)  
and the relevant logs

```auto
Jul 08, 2023 10:14:18 AM FINE jenkins.plugins.slack.StandardSlackService
Posting: to on foo: {"attachments":[{"fallback":"Slack/Jenkins plugin: you're all set on http://jenkins-controller.example.com/","color":"good","fields":[{"short":false,"value":"Slack/Jenkins plugin: you're all set on http://jenkins-controller.example.com/"}],"mrkdwn_in":["pretext","text","fields"]}],"link_names":"1","unfurl_links":"true","unfurl_media":"true","channel":"","as_user":"true"}
Jul 08, 2023 10:14:18 AM FINE jenkins.plugins.slack.StandardSlackService
Posting succeeded

```

---

<div class="post-metadata">

**Author:** ![Padmahas](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/padmahas/32/8954_2.png) [@Padmahas](https://community.jenkins.io/u/Padmahas)\
**Post date:** [July 5, 2024, 3:46pm UTC](https://community.jenkins.io/t/jenkins-slack-plugin-response-400-but-test-connection-works-ok/8339/3 "2024-07-05T15:46:06Z")

</div>

Hello @vkatsikaros ,  
Did you find any solution for this problem? I’m facing the exact issue now with Jenkins 2.4.6 as well.  
It’s been one year and no one has ever replied to this post yet.

If this information helps, I’ve deployed Jenkins using jenkins.war inside Ubuntu 24.04 VirtualBox virtual machine.

Please someone let me know what’s going on here.

Thank you.
