Cannot send to Slack for a workflow (but not the others)

Hi,
I’ve got 4 workflows and all of them will send to slack at the end. All works except one of them.

It always returned this error: **Error: Both API Token and WebhookURL are empty. You need to provide one of them. If you want to use incoming webhooks provide the webhook url. If you want to use a bot to send a message provide the bot API token
**

When I take a look at the others, I found the settings are similar except for the text to be sent. Here’s the slack settings of the failed workflow in the bitrise.yml.

- slack@3.1.3:
    inputs:
    - text: 'QA test and build successful! Build number: #${BITRISE_BUILD_NUMBER}'
    - text_on_error: 'QA test and build failed! Build number: #${BITRISE_BUILD_NUMBER}'
    - fields: |
        App|${BITRISE_APP_TITLE}
        Branch|${BITRISE_GIT_BRANCH}
        Commit|${GIT_CLONE_COMMIT_MESSAGE_SUBJECT} (${GIT_CLONE_COMMIT_HASH})
        Workflow|${BITRISE_TRIGGERED_WORKFLOW_ID}
    - webhook_url: "$SLACK_WEBHOOK_URL_IOS"

I tried to change it to use API token instead of webhook like this but it still failed.

- slack@3.1.3:
    inputs:
    - text: 'QA test and build successful! Build number: #${BITRISE_BUILD_NUMBER}'
    - text_on_error: 'QA test and build failed! Build number: #${BITRISE_BUILD_NUMBER}'
    - fields: |
        App|${BITRISE_APP_TITLE}
        Branch|${BITRISE_GIT_BRANCH}
        Commit|${GIT_CLONE_COMMIT_MESSAGE_SUBJECT} (${GIT_CLONE_COMMIT_HASH})
        Workflow|${BITRISE_TRIGGERED_WORKFLOW_ID}
    - api_token: "$SLACK_API_TOKEN"
    - channel: "#kolabree-build-ios"
    - webhook_url: ''

Here are the settings of the successful ones:

- slack@3.1.3:
    inputs:
    - text: 'Branch "${BITRISE_GIT_BRANCH}" test successful! Build number: #${BITRISE_BUILD_NUMBER}'
    - emoji: ''
    - text_on_error: 'Branch "${BITRISE_GIT_BRANCH}" test failed! Build number:
        #${BITRISE_BUILD_NUMBER}'
    - fields: "App|${BITRISE_APP_TITLE}\nBranch|${BITRISE_GIT_BRANCH} \nCommit|${GIT_CLONE_COMMIT_MESSAGE_SUBJECT}
        (${GIT_CLONE_COMMIT_HASH})\nWorkflow|${BITRISE_TRIGGERED_WORKFLOW_ID}\n"
    - webhook_url: "$SLACK_WEBHOOK_URL_IOS"

- slack@3.1.3:
    inputs:
    - text: 'Beta (Testflight) test and build successful! Build number: #${BITRISE_BUILD_NUMBER}'
    - text_on_error: 'Beta (Testflight) test and build failed! Build number: #${BITRISE_BUILD_NUMBER}'
    - fields: |
        App|${BITRISE_APP_TITLE}
        Branch|${BITRISE_GIT_BRANCH}
        Commit|${GIT_CLONE_COMMIT_MESSAGE_SUBJECT} (${GIT_CLONE_COMMIT_HASH})
        Workflow|${BITRISE_TRIGGERED_WORKFLOW_ID}
    - webhook_url: "$SLACK_WEBHOOK_URL"

Where did I do wrong here? How do I fix this?

Thanks.

It turns out, I haven’t exposed the “$SLACK_WEBHOOK_URL” and “$SLACK_WEBHOOK_URL_IOS” secret key to pull reqs. It worked now.

Thanks anyway…

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.