Repository navigation
fix: correct provider edge cases found in the API audit - #13
Merged
Merged
Conversation
Audit of the Meta, Twilio, seven.io and Telegram adapters against the providers' official specs and docs (docs/audits/2026-11-20-provider-apis.md). - seven.io: tell the owner to use the JSON webhook request method and log signed non-JSON webhooks instead of dropping them silently; cut SMS at the documented 1520 characters; map 101/500/501/407004 correctly; read sms_mo Unix timestamps and the HLR roaming object. - Twilio: 21610 and OptOutType=STOP revoke consent; 21611 is transient. - Telegram: never cut the HTML text inside an entity. - Follow api.rest.prefix for webhook URLs, status callbacks, file links and the raw-body middleware. - Keep surrogate pairs whole when cutting text; honour HTTP-date Retry-After. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
github-actions Bot
pushed a commit
that referenced
this pull request
Nov 20, 2026
## [1.1.3](messagegate-v1.1.2...messagegate-v1.1.3) (2026-11-20) ### Bug Fixes * correct provider edge cases found in the API audit ([#13](#13)) ([8cc8097](8cc8097)) ### Fixed - seven.io: the admin and README now say to set the webhook's request method to **JSON**. seven.io's default sends form fields, which MessageGate cannot read; such a signed webhook now logs a warning instead of being dropped without a trace. - seven.io: SMS texts are cut at 1520 characters (the documented limit) instead of 1600, so texts between 1521 and 1600 characters no longer fail with code 401. - seven.io: return code 101 for the single recipient is a rejection with the recipient's own error code instead of `uncertain`; 500 (no credit) and 501 (spending limit) mark the account unhealthy; 407004 (recipient unsubscribed) revokes SMS consent. - seven.io: inbound SMS keep their real receive time (`time` is a Unix timestamp); HLR checks return `roaming` from the documented object. - Twilio: error 21610 (recipient replied STOP) and an inbound `OptOutType=STOP` (Advanced Opt-Out) revoke consent for the channel, so later sends stop at the consent check instead of failing at Twilio. Error 21611 (sender queue full) is retried. - Telegram: long texts with `&`, `<` or `>` are no longer cut inside an HTML entity (the Bot API refused them); the 4096 limit counts visible characters. - Webhook URLs, Twilio status callbacks, signed file links and the webhook raw-body capture follow `api.rest.prefix`. With a custom prefix every webhook used to fail the signature check. - Outgoing texts are never cut inside an emoji. - `Retry-After` given as an HTTP date is honoured (capped at 24 hours). ### Documentation - `docs/audits/2026-11-20-provider-apis.md`: audit of all four provider APIs against their official specs and docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Audit of all four provider adapters against the providers' current official specs and docs (retrieved 2026-11-20). Full table with sources:
docs/audits/2026-11-20-provider-apis.md.200and was dropped silently. Now: admin hint (5 locales) + README say "request method JSON", and a signed non-JSON body logs a warning naming the fix./apihard-coded: with a customapi.rest.prefixevery webhook failed the signature check (raw body not captured) and all shown URLs were wrong.&→ Bot API "can't parse entities" (permanent failure). Now counts visible characters, never cuts an entity.uncertain; 500/501 did not flag the account; 407004 (unsubscribed) did not revoke consent.OptOutType=STOPdid not revoke consent (later sends kept failing at Twilio).sms_moUnix time; HLRroamingobject; HTTP-dateRetry-After; Twilio 21611 (queue full) now transientNo API or schema change. Patch release.
Tests
Regression tests for every fix (all fail on
main, verified by stashingserver/src):tests/adapters.test.js,tests/webhooks.test.js,tests/plugin.test.js(custom REST prefix),tests/admin.test.js(webhook hints). A new test fails 90 days before the end of support of the pinned Graph API version (v23.0 until 2027-10-08).Local:
npm run lint,npm run format:check,npm test(170 pass),npm run test:admin,npm run build,npm run verify.docs/site/llms-full.txtis regenerated from README/AGENTS (required bytests/docs.test.js); no otherdocs/sitefile is touched.🤖 Generated with Claude Code