# Capture Thought Shortcut action map

Version: 1.0.1

Build the Shortcut from top to bottom. Everything that sends data belongs inside the true branch of the first `If` block.

## Finished stack

```text
Dictate Text

If Dictated Text has any value
  URL
  Get Contents of URL
  Get records from Contents of URL
  Get First Item from Dictionary Value
  Get id from Item from List
  Get Text from Dictionary Value

  If Text has any value
    Show Notification: Thought saved
  Otherwise
    Show Alert: Thought not confirmed
  End If

Otherwise
  Stop This Shortcut
End If
```

## 1. Dictate Text

Add `Dictate Text`.

- Language: your preferred language
- Stop Listening: `On Tap`

Run this action by itself once. Allow microphone and speech-recognition access if iOS asks.

## 2. Blank-text guard

Add `If` below Dictate Text.

Set the condition to:

```text
If Dictated Text has any value
```

Add `Stop This Shortcut` between `Otherwise` and `End If`.

All remaining actions go above `Otherwise`, inside the branch for valid text.

## 3. Airtable URL

Add `URL` inside the valid-text branch:

```text
https://api.airtable.com/v0/YOUR_AIRTABLE_BASE_ID/YOUR_TABLE_ID
```

Replace only the two placeholders. Keep real identifiers out of this file and any public issue.

## 4. Get Contents of URL

Add `Get Contents of URL` below the URL action.

- Method: `POST`
- Request Body: `JSON`

Add these headers:

```text
Authorization    Bearer YOUR_AIRTABLE_TOKEN
Content-Type     application/json
```

There is one space between `Bearer` and the token.

## 5. Request body

Build this nested shape in the Request Body editor:

```text
records  [Array]
  Item 1  [Dictionary]
    fields  [Dictionary]
      Raw Thought          [Dictated Text variable]
      Processing Status    New
```

The generated JSON must represent:

```json
{
  "records": [
    {
      "fields": {
        "Raw Thought": "Dictated Text variable",
        "Processing Status": "New"
      }
    }
  ]
}
```

Select the blue `Dictated Text` variable for the Raw Thought value. Don't type the words `Dictated Text` as ordinary text.

On some iPhone versions, an Array still uses the label `Add new field`. Change the array item to a Dictionary, open it, then add the nested `fields` Dictionary.

## 6. Temporary connection check

Add `Show Result` directly after `Get Contents of URL`.

Run a harmless test. Confirm the response includes a `records` list and a created record ID. Then confirm the Airtable row exists.

Remove `Show Result` after this check.

## 7. Read the created record ID

Add these actions in order:

1. `Get Dictionary Value` with key `records` from Contents of URL.
2. `Get Item from List` set to `First Item`.
3. `Get Dictionary Value` with key `id` from the first item.
4. `Get Text from Input` using the ID value.

The text conversion matters. Without it, Shortcuts may guess that the untyped value is a file and offer a condition that has nothing to do with the ID.

## 8. Success and failure branches

Add another `If` below `Get Text from Input`.

Set it to:

```text
If Text has any value
```

Inside the true branch, add:

```text
Show Notification: Thought saved
```

Inside `Otherwise`, add a Show Alert action:

```text
Title: Thought not confirmed
Message: Airtable did not return a record ID. Check the Shortcut before trying again.
```

Only the returned ID earns the success message. A red Shortcuts error also means the save wasn't confirmed.

## 9. Final nesting check

Look at the indentation before you test. The URL, POST, response actions, and inner ID check must sit inside the first `If` block. The blank branch contains only `Stop This Shortcut`.

Run the full manual acceptance list in `capture-workflow.md` before assigning the Action Button.
