最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Failure in using Slack API in Jenkins - Stack Overflow

programmeradmin4浏览0评论

I'm trying to follow Enabling threaded Slack messages while using the Jenkins Slack plugin, and have created the app, and sent it to my Slack workspace. The xoxp-*** is from the "OAuth & Permissions" menu of the app I created that has Bot chat:write permissions, that I've installed to my workspace. To test I do this

node("build-node") {
    final String slackUrl = "***"
    final String token = "xoxp-***"
    stage("Test") {
        def slackResponse = slackSend(botUser: true, baseUrl: slackUrl, tokenCredentialId: token, channel: "ecs-feature", message: "Here is the primary message")
        slackSend(botUser: true, channel: slackResponse.threadId, message: "Thread reply #1")
        slackSend(botUser: true, channel: slackResponse.threadId, message: "Thread reply #2")
    }
}

but get:

Slack Send Pipeline step running, values are - baseUrl: ***, teamDomain: myWorkspace, channel: ecs-feature, color: <empty>, botUser: true, tokenCredentialId: xoxp-***, notifyCommitters: false, iconEmoji: <empty>, username: <empty>, timestamp: <empty>
ERROR: Slack notification failed with exception: java.lang.IllegalArgumentException: the credential with the provided ID (xoxp-***) could not be found and no token was specified
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Also:   .jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: b8ca58a3-c052-47e0-b524-5dee1c6913d0
java.lang.NullPointerException: Cannot get property 'threadId' on null object
    at .codehaus.groovy.runtime.NullObject.getProperty(NullObject.java:60)
    at .codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:190)
    at .codehaus.groovy.runtime.ScriptBytecodeAdapter.getProperty(ScriptBytecodeAdapter.java:469)

Any clues?

发布评论

评论列表(0)

  1. 暂无评论