Skip to content

feat(api): add messages.resend() to retry a terminal message - #66

Open
sudiptpa wants to merge 1 commit into
sentdm:mainfrom
sudiptpa:feat/messages-resend
Open

sudiptpa wants to merge 1 commit into
sentdm:mainfrom
sudiptpa:feat/messages-resend

Conversation

@sudiptpa

@sudiptpa sudiptpa commented Oct 31, 2026 •

Copy link
Copy Markdown

What's missing

POST /v3/messages/{id}/resend is live in production and documented in the current spec
(https://api.sent.dm/swagger/v3/swagger.json, path /v3/messages/{id}/resend), with a
ResendMessageV3Request body (optional sandbox) and a response reusing the same shape
as POST /v3/messages. MessagesService/MessagesRawService don't expose a resend()
method yet.

Worked example:

curl -X POST -H "x-api-key: $KEY" -H "Content-Type: application/json" \
  https://api.sent.dm/v3/messages/{id}/resend -d '{"sandbox": false}'
→ 202, body shaped like POST /v3/messages' response

What changed

Adds typed support for this endpoint, matching the pattern every other message method
already uses:

  • MessagesService::resend(string $id, ?bool $sandbox = null, ?string $idempotencyKey = null, ?string $xProfileID = null, ...): MessageSendResponse
  • MessagesRawService::resend(string $id, array|MessageResendParams $params, ...): BaseResponse
  • New class SentDm\Messages\MessageResendParams, with properties sandbox, idempotencyKey, xProfileID, same shape as the other mutation request params in this service
  • Matching additions to MessagesContract and MessagesRawContract

Purely additive. No existing generated line is changed.

Checked the other Sent SDKs too

Before writing this, checked whether the other SDKs already cover this endpoint. None of
them do: TypeScript, Python, Ruby, and Go each have only a docblock mention of
POST /v3/messages/{id}/resend in their overview comments, no generated resend() method.
Java and C# don't mention it at all. So this looks like a cross-family generator lag on this
one endpoint, not something PHP is uniquely behind on.

Note for review

This repo's commit history shows the spec gets re-synced from production every 1-3 days
(feat(api): sync OpenAPI spec from production → feat(api): sync generated SDKs from the committed spec), and this endpoint is already in that live spec. There's a real
chance the next sync generates this same method before this PR lands. Flagging that up
front rather than leaving it for review to discover, in case it's simpler to just let the
pipeline pick it up instead of merging this by hand.

How I verified it

Request/response shapes checked directly against the live OpenAPI document, not guessed
from the endpoint name. ./scripts/lint passes. ./scripts/test passes for the parts
that don't depend on the mock server (which is disabled in this environment); the new
test matches the existing SDK test style for other message methods.

Adds typed support for POST /v3/messages/{id}/resend: the public
messages->resend() method, the raw service method, a request params
model, contracts, and a test matching the existing SDK style.

Resend reruns the original send on the same message id, typically to
retry one blocked for insufficient balance. It bills again and reruns
every send policy, so it can land on blocked or filtered again. Only a
terminal message (delivered, failed, read, blocked) or one stuck at sent
for over 15 minutes can be resent; filtered never can. The channel stays
the one the message originally used.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-31T06:37:19.234818Z
We couldn’t complete this review. Comment @codex review to try again.
7a4a623 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@sudiptpa

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant