> ## Documentation Index
> Fetch the complete documentation index at: https://docs.asccli.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Notify

# notify

> Send notifications to external services (Slack, etc.)

Send notifications to external services like Slack to integrate App Store Connect CLI into your CI/CD workflows.

## Quick Start

```bash theme={null} theme={null}
export ASC_SLACK_WEBHOOK="https://hooks.slack.com/services/..."
asc notify slack --message "Build uploaded"
asc notify slack --message "Release ready" --channel "#deployments"
```

## Subcommands

* `slack` - Send a message to Slack via webhook

## Commands

### notify slack

Send a message to Slack via incoming webhook:

```bash theme={null} theme={null}
asc notify slack --webhook "https://hooks.slack.com/..." --message "Build uploaded"
asc notify slack --message "Done" --channel "#deployments"
ASC_SLACK_WEBHOOK=$WEBHOOK asc notify slack --message "Release v2.1 ready"
```

**Flags:**

* `--webhook` - Slack webhook URL (or set `ASC_SLACK_WEBHOOK` env var)
* `--channel` - Slack channel override (`#channel` or `@username`)
* `--message` - Message to send to Slack (required)
* `--thread-ts` - Parent message timestamp (thread\_ts) for posting a threaded reply
* `--blocks-json` - Slack Block Kit JSON array
* `--blocks-file` - Path to Slack Block Kit JSON array file
* `--payload-json` - JSON object of release fields to include as Slack attachment fields
* `--payload-file` - Path to JSON object file for release payload fields
* `--pretext` - Optional text shown above attachment payload fields (requires `--payload-json`/`--payload-file`)
* `--success` - Set attachment color to success (`true`) or failure (`false`, default: `true`)

## Basic Usage

### Simple Message

```bash theme={null} theme={null}
asc notify slack \
  --webhook "https://hooks.slack.com/services/..." \
  --message "Build uploaded successfully"
```

### Channel Override

```bash theme={null} theme={null}
asc notify slack \
  --message "Deployment complete" \
  --channel "#deployments"
```

**Note:** Slack may ignore channel overrides for incoming webhooks based on app settings.

### Environment Variable

Set the webhook URL via environment variable:

```bash theme={null} theme={null}
export ASC_SLACK_WEBHOOK="https://hooks.slack.com/services/..."
asc notify slack --message "Build complete"
```

## Advanced Features

### Threaded Replies

Post a message as a reply to an existing thread:

```bash theme={null} theme={null}
asc notify slack \
  --message "Build update" \
  --thread-ts "1733977745.12345"
```

**Note:** The `thread-ts` value must be in Slack timestamp format (e.g., `1733977745.12345`). Webhook POST returns only "ok", so you need to obtain the parent message ts from Slack APIs/events.

### Block Kit Messages

Use Slack Block Kit for rich message formatting:

```bash theme={null} theme={null}
asc notify slack \
  --message "Release ready" \
  --blocks-json '[{"type":"section","text":{"type":"mrkdwn","text":"*Release* ready"}}]'
```

Or load from a file:

```bash theme={null} theme={null}
asc notify slack \
  --message "Release ready" \
  --blocks-file ./blocks.json
```

**blocks.json:**

```json theme={null} theme={null}
[
  {
    "type": "section",
    "text": {
      "type": "mrkdwn",
      "text": "*Release v2.1.0* ready for deployment"
    }
  },
  {
    "type": "section",
    "fields": [
      {
        "type": "mrkdwn",
        "text": "*App:*\nMyApp"
      },
      {
        "type": "mrkdwn",
        "text": "*Version:*\n2.1.0"
      }
    ]
  }
]
```

### Attachment Payloads

Include structured data as attachment fields:

```bash theme={null} theme={null}
asc notify slack \
  --message "Release submitted" \
  --payload-json '{"app":"MyApp","version":"1.2.3","build":"42"}'
```

With pretext and color:

```bash theme={null} theme={null}
asc notify slack \
  --message "Release submitted" \
  --pretext "New release ready" \
  --payload-json '{"app":"MyApp","version":"1.2.3","build":"42"}' \
  
```

Or load from a file:

```bash theme={null} theme={null}
asc notify slack \
  --message "Release submitted" \
  --payload-file ./release.json
```

**release.json:**

```json theme={null} theme={null}
{
  "app": "MyApp",
  "version": "1.2.3",
  "build": "42",
  "platform": "iOS",
  "submitted": "2026-03-04T12:34:56Z"
}
```

## CI/CD Integration

### GitHub Actions

```yaml theme={null} theme={null}
name: Notify Slack
on:
  workflow_dispatch:

jobs:
  notify:
    runs-on: ubuntu-latest
    steps:
      - name: Notify Slack
        env:
          ASC_SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
        run: |
          asc notify slack --message "Build uploaded for MyApp v1.2.3"
```

### GitLab CI

```yaml theme={null} theme={null}
notify:
  stage: notify
  script:
    - asc notify slack --message "Pipeline complete for $CI_COMMIT_REF_NAME"
  variables:
    ASC_SLACK_WEBHOOK: $SLACK_WEBHOOK
```

### Fastlane Integration

```ruby theme={null} theme={null}
lane :notify_slack do |options|
  message = options[:message] || "Build complete"
  sh(
    "asc",
    "notify",
    "slack",
    "--message",
    message
  )
end
```

## Examples

### Build Upload Notification

```bash theme={null} theme={null}
#!/bin/bash
set -e

# Upload build
asc builds upload --ipa ./MyApp.ipa

# Notify Slack
asc notify slack \
  --message "New build uploaded for MyApp" \
  --payload-json '{"version":"1.2.3","build":"42"}'
```

### TestFlight Distribution

```bash theme={null} theme={null}
#!/bin/bash
set -e

BUILD_ID="12345"
GROUP_ID="67890"

# Add build to TestFlight group
asc builds add-groups --build-id "$BUILD_ID" --group "$GROUP_ID"

# Notify Slack
asc notify slack \
  --message "Build distributed to TestFlight" \
  --channel "#qa" \
  --payload-json '{"build":"'$BUILD_ID'","group":"Internal Testers"}'
```

### Submission Status

```bash theme={null} theme={null}
#!/bin/bash
set -e

VERSION="1.2.3"
IPA_PATH="./build/MyApp.ipa"

# Publish to the App Store
asc publish appstore \
  --app "$APP_ID" \
  --ipa "$IPA_PATH" \
  --version "$VERSION" \
  --submit \
  --confirm

# Notify Slack with success
asc notify slack \
  --message "Version $VERSION submitted for review" \
  --pretext "App Store submission" \
  --payload-json '{"app":"MyApp","version":"'$VERSION'","ipa":"'$IPA_PATH'"}' \
  
```

### Error Notification

```bash theme={null} theme={null}
#!/bin/bash

# Run command and capture error
if ! asc builds upload --ipa ./MyApp.ipa 2>&1; then
  # Notify Slack on failure
  asc notify slack \
    --message "Build upload failed" \
    --pretext "CI/CD Error" \
    --payload-json '{"job":"upload","status":"failed"}' \
    --success=false
  exit 1
fi
```

## Security

### Webhook URL Security

* Only `https://hooks.slack.com` and `https://hooks.slack-gov.com` are allowed by default
* IP addresses are rejected
* The webhook URL must start with `/services/`
* For local testing, set `ASC_SLACK_WEBHOOK_ALLOW_LOCALHOST=1` to allow `http://localhost`

### Environment Variables

Store sensitive webhook URLs in environment variables or CI/CD secrets:

```bash theme={null} theme={null}
# Don't commit webhook URLs to version control
export ASC_SLACK_WEBHOOK="https://hooks.slack.com/services/..."

# Use in CI/CD
asc notify slack --message "Build complete"
```

## Troubleshooting

### Channel Override Not Working

Slack may ignore channel overrides for incoming webhooks based on app configuration. Configure the default channel in your Slack app settings.

### Webhook Returns Error

Check that:

* The webhook URL is valid and active
* The URL starts with `https://hooks.slack.com/services/` or `https://hooks.slack-gov.com/services/`
* The message is not empty
* JSON payloads are valid

### Message Not Appearing

Verify:

* The webhook URL is correct
* The Slack app has permission to post to the channel
* The message format is valid
* Block Kit JSON is properly formatted
