Skip to content

reply command sends addressed fields as JSON arrays instead of comma-separated strings, causing 422 or drafts #66

@jaxson

Description

@jaxson

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

  1. hey reply <topic_id> -m "test"
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions