Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ prints JSON (indented; compact with `--json`) and says what happened in a stable
| `reply contact delete <id>` | → `deleted` |
| `reply contact opt-out <contact>` | → `opted_out` |
| `reply contact send-email <contact> --email-account-id N --message - [--track-links] [--track-opens]` | one email outside any sequence → `sent` |
| `reply contact send-email <contact> --email-account-id N --follows email-<n> --message -` | a follow-up in an earlier direct email's thread, its `{body}` alone → `sent`, with its `reference` |
| `reply contact linkedin-connect <contact> --linkedin-account-id N [--message -]` | a LinkedIn invitation, with or without a note → `sent` / `already_connected` |
| `reply contact linkedin-message …` · `linkedin-inmail …` · `linkedin-voice …` | a LinkedIn message, an InMail, or an AI voice message spoken from a script → `sent` |
| any direct send `… [--send-after <moment>] [--schedule-id N] [--idempotency-key K]` | the send held until a moment, timed by a schedule, under a key of yours → `sent`, with its `reference` and `state` |
Expand Down Expand Up @@ -352,6 +353,26 @@ it. Neither sends anything, and `reply_code` keeps Reply's own code, as on every
# {"error":{"status":429,"code":"email.limit_reached",…,"reply_code":"contact.dailyLimitReached","retry_after":43200,"details":{"limit":"daily"}}}
```

`contact send-email --follows <reference>` sends the email as a follow-up in the thread of an earlier
direct email, named by the `reference` that send answered: `email-<n>`, `n` from 1 with no leading
zero; any other form is refused before any call (`usage.reference`). The follow-up goes under its
thread's subject, so its message is `{body}` alone, and one carrying a `subject` is refused
(`usage.message`, exit 2). It goes to the contact and from the mailbox of the email it follows, takes
every other flag of a plain send, and its answer always carries Reply's `reference`. Reply refuses it,
and nothing is sent, when that email is none this account can see (`follows.not_found`) or a
teammate's this user may not act for (`follows.not_owned`), went to another contact or goes from
another mailbox (`follows.other_contact`, `follows.other_mailbox`), was cancelled or failed for good
(`follows.never_sent`), has not gone out yet while the follow-up would go at once (`follows.not_sent`:
give it a later `--send-after` or a `--schedule-id`), is due no earlier than the follow-up's
`--send-after` (`follows.too_early`), or went out but can no longer be found (`follows.not_placed`).
A Reply without follow-ups answers the route with a `404` and no code of its own: that is
`follows.not_available`, and nothing else is tried in its place.

```sh
echo '{"body":"<p>Hi Ann, just bringing this back up.</p>"}' | reply contact send-email --contact-id 456 --email-account-id 12 --follows email-1001 --message - --send-after 2026-11-06T14:00:00Z
# {"status":"sent",…,"reference":"email-1002","send_after":"2026-11-06T14:00:00Z","state":"queued"}
```

Every direct send also takes `--send-after <moment>`, `--schedule-id <id>` and
`--idempotency-key <key>`. Reply holds the send until the moment, given with its offset
(`2026-11-03T14:00:00Z`, `2026-11-03T16:00:00+02:00`) and sent to Reply in UTC; a moment without an
Expand Down Expand Up @@ -429,7 +450,12 @@ neither. So is `estimated_send_at`, read the same way as on the send but as of t
not open within 30 days counted from `--send-after`, or from now once that has passed.
`failure_reason` is a sentence for a person and never parsed; `failure_code` is Reply's code for the
failure, the one to branch on. A failed send may carry no `failure_code`: it is then null, and
`failure_reason` is all Reply says of it. `direct-send cancel` of a send already cancelled answers
`failure_reason` is all Reply says of it. `follows` is added only when Reply gives it: the reference
of the email a follow-up went in the thread of, or null for a send that follows none. A follow-up
that failed may carry the `failure_code` `contact.followedSendNotSent` (that email had not gone out
when the follow-up was due), `contact.followedSendNeverSent` (it was cancelled or failed for good) or
`contact.followUpNotPlaced` (Reply could not find it to answer in its thread), passed on as given.
`direct-send cancel` of a send already cancelled answers
it again. A send already gone out, failed or going out is `direct_send.already_sent`,
`direct_send.already_failed` or `direct_send.already_sending`; the last is a LinkedIn send made for
later that Reply is handing to the account's queue or that waits or runs there, even while
Expand Down
9 changes: 8 additions & 1 deletion skills/reply-adapter/reply-api/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: >
Use before calling any non-trivial v3 endpoint, when choosing an endpoint for a task,
or when an API call fails and needs interpretation.
metadata:
version: 1.5.1
version: 1.6.0
pack: reply-adapter
category: execution
maturity: reviewed
Expand Down Expand Up @@ -124,6 +124,11 @@ per-page `.md` fetches; the spec is large.
"Nothing went out; sending again is safe" - while `directSend.dispatchInterrupted` is to be
read as `unknown`, not `failed`: it may have gone out - "check before sending again" - so read
the person's thread before any new send.
- **A follow-up in the thread:** `reply contact send-email --follows <reference>` sends the email
in the thread of an earlier direct email, named by the `reference` that send answered
(`email-<n>`), to its contact and from its mailbox; the message is `{body}` alone, since it goes
under the thread's subject. Its refusals are the `follows.*` codes its `--help` lists, and
`follows.not_available` says the account's Reply does not offer follow-ups: nothing was sent.
- **A lost answer:** where an earlier try returned a `reference`, read it first with `reply
direct-send get <reference>` (from reply-cli 0.17.0), and let its state decide; repeat only
when the read says nothing of the send. Reply keeps a key for a day, so a repeat goes under
Expand Down Expand Up @@ -209,6 +214,8 @@ skill's confirmation rules — especially anything that sends messages or starts

## Changelog

- 1.6.0 (2026-11-23): *Direct sends* says how to send an email as a follow-up in an earlier direct
email's thread with `--follows`, and what `follows.not_available` means.
- 1.5.1 (2026-11-05): *Conventions* and the error table say that a 429 naming a `reference` or
saying a daily or weekly limit was reached is never resent and comes back at once as the refusal
it is.
Expand Down
44 changes: 42 additions & 2 deletions src/__tests__/operations/commands.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,9 @@ describe('operations/commands', ()=>{
const SENT_AT_AS_GIVEN = 'sentAtUtc as Reply gives them, each null when it gives none; the CLI adds no time of its own';
const DIRECT_SENDS: [string, string, string[], string][] = [
['send-email', '--email-account-id', ['contact.not_found', ...IMPORT, 'contact.already_held', 'email_account.not_found', 'contact.blacklisted',
'contact.missing_variables', 'contact.rendering_failed', 'email.limit_reached', 'email.sending_disabled', 'schedule.not_found', 'schedule.no_slot', 'contact.time_zone_missing'],
'contact.missing_variables', 'contact.rendering_failed', 'email.limit_reached', 'email.sending_disabled', 'follows.not_available',
'follows.not_found', 'follows.not_owned', 'follows.other_contact', 'follows.other_mailbox', 'follows.never_sent', 'follows.not_sent',
'follows.too_early', 'follows.not_placed', 'schedule.not_found', 'schedule.no_slot', 'contact.time_zone_missing'],
'sent_at is always null; the CLI adds none of its own'],
['linkedin-connect', '--linkedin-account-id', [...LINKEDIN, 'linkedin.not_connected', 'linkedin.limit_reached',
'linkedin.message_too_long', 'linkedin.missing_variables'], SENT_AT_AS_GIVEN],
Expand All @@ -331,7 +333,7 @@ describe('operations/commands', ()=>{
{
const c = sub(contact_command, name);
expect(flags(c), name).toEqual([...CONTACT_FLAGS, account_flag, '--message',
...(name === 'send-email' ? ['--track-links', '--track-opens'] : []), '--send-after', '--schedule-id', '--idempotency-key',
...(name === 'send-email' ? ['--track-links', '--track-opens', '--follows'] : []), '--send-after', '--schedule-id', '--idempotency-key',
'--use-contact-time-zone', '--no-use-contact-time-zone', ...(name === 'send-email' ? [] : ['--retry-window-minutes'])]);
const text = help_of(c);
const flat = text.replace(/\s+/g, ' ');
Expand Down Expand Up @@ -416,6 +418,44 @@ describe('operations/commands', ()=>{
expect(flat, flat).toContain('email.sending_disabled (403) is a mailbox or team that cannot send direct emails now');
});

it('send-email takes --follows, shows it in an example, and says what a follow-up takes and how each of its refusals reads', ()=>{
const c = sub(contact_command, 'send-email');
const text = help_of(c);
const flat = text.replace(/\s+/g, ' ');
const follows = c.options.find(o=>o.long === '--follows');
expect(follows?.flags).toBe('--follows <reference>');
expect(follows?.description).toContain('a follow-up in the thread of this earlier direct email');
expect(c.options.find(o=>o.long === '--message')?.description).toContain('with --follows, {body} alone');
expect(text, text).toContain('contact send-email --contact-id 456 --email-account-id 12 --follows email-1001 --message -');
expect(flat, flat).toContain('--follows <reference> sends the email as a follow-up in the thread of an earlier direct email');
expect(flat, flat).toContain('email-<n> with n from 1 and no leading zero; any other form is refused before any call (usage.reference, exit 2)');
expect(flat, flat).toContain('The follow-up goes under its thread\'s subject, so its message is {body} alone: a message with a subject is '
+ 'refused (usage.message, exit 2) and nothing is sent');
expect(flat, flat).toContain('It goes to the contact and from the mailbox of the email it follows, and its answer always carries Reply\'s reference');
for (const code of ['follows.not_found', 'follows.not_owned', 'follows.other_contact', 'follows.other_mailbox', 'follows.never_sent',
'follows.not_sent', 'follows.too_early', 'follows.not_placed'])
{
expect(text, code).toContain(` ${code}\n`);
expect(flat.split('Errors')[0], code).toContain(code);
}
expect(flat, flat).toContain('follows.not_available: this Reply\'s follow-up route answers 404 with no code of Reply\'s, so it does not offer '
+ 'follow-ups; nothing else is tried in its place');
expect(flat, flat).toContain('None of them sends anything, and each of the others keeps Reply\'s code in reply_code');
expect(c.description(), c.description()).toContain('with --follows, in an earlier direct email\'s thread');
});

it('direct-send get says when follows is given and which failure codes a follow-up may carry', ()=>{
for (const name of ['get', 'cancel'])
{
const flat = help_of(sub(direct_send_command, name)).replace(/\s+/g, ' ');
expect(flat, name).toContain('follows is added only when Reply gives it: the reference of the earlier direct email a follow-up went in '
+ 'the thread of (send-email --follows), or null for a send that follows none');
expect(flat, name).toContain('contact.followedSendNotSent (that email had not gone out when the follow-up was due), '
+ 'contact.followedSendNeverSent (it was cancelled or failed for good) or contact.followUpNotPlaced');
expect(flat, name).toContain('like every failure_code, each is passed on as Reply gives it');
}
});

it('direct-send get says when the bounce members are given and what each holds', ()=>{
const flat = help_of(sub(direct_send_command, 'get')).replace(/\s+/g, ' ');
expect(flat, flat).toContain('bounced, bounce_type and bounced_at are added only when Reply gives them');
Expand Down
Loading
Loading