Bug Description
The hey reply command fails with a 422 Unprocessable Content error (or silently creates a draft instead of sending) because the SDK's CreateReply method in hey-sdk/go v0.3.0 sends the addressed fields (directly, copied, blindcopied) as JSON arrays (["email@example.com"]) instead of comma-separated strings ("email@example.com").
Steps to Reproduce
hey reply <topic_id> -m "test"
- Observe 422 response from
POST /entries/{id}/replies.json
Root Cause
In hey-sdk/go@v0.3.0/pkg/hey/entries.go, the CreateReply method (lines 74-88) assigns []string slices directly to the addressed map:
addressed["directly"] = to // []string{"alice@example.com"}
But the HEY API's MessageAddressed type (in the generated OpenAPI types) defines these as comma-separated strings:
type MessageAddressed struct {
Directly string `json:"directly,omitempty"`
Copied string `json:"copied,omitempty"`
Blindcopied string `json:"blindcopied,omitempty"`
}
Additionally, without the addressed block, the API creates a draft instead of sending.
Workaround
Bypass CreateReply in the CLI and call PostMutation directly with strings.Join(emails, ", ") for each addressed field.
Introduced In
Commit 6ce1992 ("Fix reply command to send instead of creating a draft") / SDK upgrade to v0.3.0.