streak-draft-created
Notify Streak after creating a Gmail draft with the gws CLI. Run this immediately after every successful `gws gmail ... --draft` (send, reply, or reply-all) so Streak records the draft against the box. It POSTs the draftId, threadId, forUserEmail, and whether the draft was a reply to the box's draftCreated endpoint.
Savant verdict: Pending analysis
Imported from the source hub; Savant's analysis is still running.
Live evaluation
Not evaluated yet. Workspaces can request a live evaluation.
Safety (NVIDIA SkillSpector)
Scan pending.
Structure
- No license declaredConfirm you may reuse this skill before importing it into your repository.
SKILL.md
---
name: streak-draft-created
description: Notify Streak after creating a Gmail draft with the gws CLI. Run this immediately after every successful `gws gmail ... --draft` (send, reply, or reply-all) so Streak records the draft against the box. It POSTs the draftId, threadId, forUserEmail, and whether the draft was a reply to the box's draftCreated endpoint.
---
# Notify Streak that a draft was created
Whenever you create a Gmail draft with `gws` (a new draft via `gws gmail +send ... --draft`, or a threaded reply via `gws gmail +reply` / `+reply-all ... --draft`), Streak does **not** learn about that draft on its own. You must tell it, by POSTing to the box's `draftCreated` endpoint. Do this once per draft, right after the `gws` command succeeds.
If you skip this step the draft still exists in the user's Gmail, but Streak has no record of it — the box timeline will be wrong and later sessions may not know the draft was already written.
## When to run
Run this **exactly once for each draft you successfully create**, immediately after the `gws` command returns success. Do not run it if the `gws` command failed, and do not run it more than once for the same draft (that would create duplicate records).
## Endpoint
```
POST https://$STREAK_API_HOST/api/v2/boxes/$BOX_KEY/draftCreated
Authorization: Bearer $STREAK_API_KEY
Content-Type: application/json
```
`$STREAK_API_HOST`, `$STREAK_API_KEY`, and `$BOX_KEY` are already set in your environment (in production `$STREAK_API_HOST` resolves to `api.streak.com`). Always use these variables rather than hardcoding the host, so the call works in both dev and production.
## Request body
```json
{
"draftId": "r-12345678",
"threadId": "19ab34cd56",
"forUserEmail": "user@example.com",
"isReply": false
}
```
| Field | Where it comes from |
|-------|---------------------|
| `draftId` | The draft's `id` from the JSON that the `gws` draft command printed on success (Gmail draft ids look like `r-…`). |
| `threadId` | The `threadId` of the draft's message, also from the `gws` output. For a reply this is the existing thread; for a new draft it is the thread Gmail created for it. |
| `forUserEmail` | The exact address you passed as `--email=<address>` to `gws` (the team member in whose mailbox the draft was created). |
| `isReply` | `false` for a new draft (`gws gmail +send`); `true` for a reply drafted with `gws gmail +reply` or `+reply-all`. |
### Getting `draftId` and `threadId` from the gws output
Capture the `gws` command's output and read the two ids from it. The `gws-gmail-send` / `gws-gmail-reply` skills document the exact output shape; the draft `id` and the message `threadId` are what you need. For example, if you saved the command's JSON output to `draft.json`:
```bash
DRAFT_ID=$(jq -r '.id' draft.json)
THREAD_ID=$(jq -r '.message.threadId // .threadId' draft.json)
```
Adapt the `jq` paths to the actual field names in the `gws` output if they differ — the goal is the Gmail draft id and its thread id.
## Making the call
```bash
curl -sS -X POST \
"https://$STREAK_API_HOST/api/v2/boxes/$BOX_KEY/draftCreated" \
-H "Authorization: Bearer $STREAK_API_KEY" \
-H "Content-Type: application/json" \
--fail-with-body \
-d "$(jq -nc \
--arg draftId "$DRAFT_ID" \
--arg threadId "$THREAD_ID" \
--arg forUserEmail "user@example.com" \
--argjson isReply false \
'{draftId:$draftId, threadId:$threadId, forUserEmail:$forUserEmail, isReply:$isReply}')"
```
Building the body with `jq -nc` (rather than hand-writing the JSON string) avoids quoting mistakes and guarantees valid JSON. Set `forUserEmail` to the address you used for `--email`, and `isReply` to `true` for replies.
## After the call
- On success (2xx), the draft is recorded — note it in your final summary (e.g. "drafted a reply for user@example.com and notified Streak").
- On failure, **do not troubleshoot or retry in a loop.** Include the HTTP status and response body in your final summary so it can be investigated, and continue with any other useful action. A failed notification does not undo the draft — never delete or re-create the draft to "fix" it.