Skip to content

Inbound documentation#38

Merged
piobeny merged 1 commit into
mainfrom
MT-22010-docs-update-documentation
May 29, 2026
Merged

Inbound documentation#38
piobeny merged 1 commit into
mainfrom
MT-22010-docs-update-documentation

Conversation

@piobeny

@piobeny piobeny commented May 8, 2026

Copy link
Copy Markdown
Contributor

Motivation

Document the Inbound email API (folders, inboxes, messages) and the companion inbound_receiving webhook type so external integrators can build against it from the public docs.

Changes

  • Add specs/inbound.openapi.yml covering 13 operations across three tags: Folders, Inboxes, Messages (list/create/update/delete folders and inboxes, list/get/delete messages, fetch raw bodies and attachments).
  • Extend specs/email-sending.openapi.yml Webhook schema with the new inbound_receiving event type and inbound_inbox_id field — required when creating an inbound webhook, ignored for other webhook types.
  • Disable Spectral's duplicated-entry-in-enum rule in .spectral.yaml. Upstream regression in @stoplight/spectral-rulesets@1.22.3 (2026-05-21) crashes nimma when traversing past null values in examples; this halted lint CI on this branch and would have done the same on the next push to main.
  • Update README.md spec table with the Inbound row and align column widths.

How to test

  • Review the new Inbound API reference in the GitBook preview — walk through Folders, Inboxes, and Messages and confirm each operation, request shape, and response example reads correctly.
  • Review the updated Webhooks reference and confirm inbound_receiving appears as a webhook type with inbound_inbox_id documented as the link to the receiving inbox.

Summary by CodeRabbit

  • New Features

    • Added support for inbound webhook type with new configuration field for inbox management
    • Introduced new Inbound API specification with REST endpoints for managing folders, inboxes, and messages with cursor-based pagination
  • Documentation

    • Updated documentation to include Inbound API specification reference
  • Chores

    • Updated development configuration to address upstream rule processing issue

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 8, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR introduces the Inbound API v2.0.0 specification, extends the email-sending webhook contract to support inbound webhook notifications with an inbox reference field, updates the README to list the new Inbound API, and disables a Spectral linting rule due to an upstream regression.

Changes

Inbound API and Webhook Integration

Layer / File(s) Summary
Inbound API OpenAPI specification
specs/inbound.openapi.yml
New OpenAPI 3.1 specification defining the complete Inbound API v2.0.0 with authentication (Api-Token and Bearer JWT), REST endpoints for managing folders, inboxes, and messages, cursor-based pagination support, presigned download URLs, decoded message bodies, and comprehensive error/validation response schemas.
Email sending webhook type and inbox field additions
specs/email-sending.openapi.yml
Webhook contract extended to support inbound_receiving webhook type; new inbound_inbox_id field (nullable integer) added to webhook create, update, and response schemas with descriptions scoping the field to inbound_receiving webhooks only; trailing whitespace corrected in webhook tag description.
Documentation and configuration updates
README.md, .spectral.yaml
README "Available Specifications" table reformatted and expanded with a new row documenting the Inbound API and its base URL; Spectral rule duplicated-entry-in-enum disabled with comment documenting the upstream regression in @stoplight/spectral-rulesets (>= 1.22.3, released 2026-05-21) that causes JSONPath traversal to fail when encountering null values in example payloads.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • leonid-shevtsov
  • IgorDobryn

Poem

🐰 New inboxes bloom in the spring,
Folders nested, messages we bring,
Webhooks awake to inbound cheer,
The API complete—now it's crystal clear!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Inbound documentation' is vague and does not specifically convey the main changes; it lacks detail about the actual modifications made across multiple files and the bug fix in Spectral configuration. Consider a more descriptive title such as 'Add Inbound API specification and webhook support' or 'Document Inbound API with webhook integration and fix Spectral rule' to better reflect the scope of changes.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description includes all required sections (Motivation, Changes, How to test) with detailed, specific information about the changes made.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch MT-22010-docs-update-documentation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@piobeny piobeny force-pushed the MT-22010-docs-update-documentation branch 2 times, most recently from f86c347 to 084714f Compare May 26, 2026 11:35
@piobeny piobeny marked this pull request as ready for review May 26, 2026 12:00
@piobeny piobeny requested a review from mklocek May 26, 2026 12:00
@piobeny piobeny changed the title MT-22010 docs update documentation MT-22010 Inbound documentation May 26, 2026

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
specs/email-sending.openapi.yml (1)

1665-1742: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Enforce inbound_inbox_id conditional validation in the create webhook schema.

The schema describes inbound_inbox_id as required for webhook_type: inbound_receiving and forbidden otherwise, but the current required list does not enforce that rule.

Proposed schema constraint
                 webhook:
                   type: object
                   required:
                     - url
                     - webhook_type
                   properties:
                     ...
                     inbound_inbox_id:
                       type: integer
                       description: |
                         ID of the inbound inbox the webhook is linked to.
                         Required for `inbound_receiving` webhooks; must not be
                         set for any other webhook type.
                       example: 1
+                  allOf:
+                    - if:
+                        properties:
+                          webhook_type:
+                            const: inbound_receiving
+                        required:
+                          - webhook_type
+                      then:
+                        required:
+                          - inbound_inbox_id
+                      else:
+                        not:
+                          required:
+                            - inbound_inbox_id
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@specs/email-sending.openapi.yml` around lines 1665 - 1742, The create webhook
schema's "webhook" object must enforce conditional validation for
"inbound_inbox_id": add an if/then/else (or oneOf) constraint on the "webhook"
schema that checks "webhook_type" == "inbound_receiving" and in the then-clause
requires "inbound_inbox_id", and in the else-clause uses "not" or "required": []
/ "properties": {"inbound_inbox_id": {"not": {}}} to forbid "inbound_inbox_id"
for other webhook_type values; update the same "webhook" object that contains
"webhook_type", "sending_stream" and "event_types" so "sending_stream" &
"event_types" conditional requirements remain intact while enforcing the
inbound_inbox_id rule.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@specs/inbound.openapi.yml`:
- Around line 70-76: The x-codeSamples block only contains a cURL example with a
literal token; expand that block to include code samples in the required
priority order (cURL/shell, Node.js/JavaScript, PHP, Python, Ruby, .NET/C#,
Java) and replace any literal API keys with environment-variable usage (e.g.,
process.env.MAILTRAP_API_KEY or equivalent for each language); update the
x-codeSamples array (the existing x-codeSamples entry) so each sample has lang,
label and source fields, and ensure the auth header examples consistently use
env vars instead of "YOUR_API_KEY".

---

Outside diff comments:
In `@specs/email-sending.openapi.yml`:
- Around line 1665-1742: The create webhook schema's "webhook" object must
enforce conditional validation for "inbound_inbox_id": add an if/then/else (or
oneOf) constraint on the "webhook" schema that checks "webhook_type" ==
"inbound_receiving" and in the then-clause requires "inbound_inbox_id", and in
the else-clause uses "not" or "required": [] / "properties":
{"inbound_inbox_id": {"not": {}}} to forbid "inbound_inbox_id" for other
webhook_type values; update the same "webhook" object that contains
"webhook_type", "sending_stream" and "event_types" so "sending_stream" &
"event_types" conditional requirements remain intact while enforcing the
inbound_inbox_id rule.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7c325698-f9ca-499b-94ae-ff16122d1372

📥 Commits

Reviewing files that changed from the base of the PR and between 8cefad0 and 084714f.

📒 Files selected for processing (4)
  • .spectral.yaml
  • README.md
  • specs/email-sending.openapi.yml
  • specs/inbound.openapi.yml

Comment thread specs/inbound.openapi.yml
Comment thread specs/inbound.openapi.yml
x-page-description: Receive inbound email
description: |
An inbox is the destination for inbound email. Each inbox is created
inside a folder and gets a unique generated address that can receive

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This will need adjustment once we ship custom domains.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Do you thing we should be more vague about address at this point?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's what I thought but I guess we will come back here and update this spec soon anyway. So it's fine as is now

Comment thread specs/inbound.openapi.yml Outdated
Comment thread specs/inbound.openapi.yml Outdated
Comment thread specs/inbound.openapi.yml Outdated
@piobeny piobeny force-pushed the MT-22010-docs-update-documentation branch from 084714f to 3cff831 Compare May 26, 2026 14:28

@coderabbitai coderabbitai 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
specs/email-sending.openapi.yml (1)

1670-1742: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Enforce conditional validation for inbound_inbox_id in create webhook schema.

The description says inbound_inbox_id is required for inbound_receiving and forbidden otherwise, but the schema does not encode that rule. This weakens contract validation for generated clients and docs consumers.

💡 Suggested schema patch
                 webhook:
                   type: object
                   required:
                     - url
                     - webhook_type
                   properties:
@@
                     inbound_inbox_id:
                       type: integer
                       description: |
                         ID of the inbound inbox the webhook is linked to.
                         Required for `inbound_receiving` webhooks; must not be
                         set for any other webhook type.
                       example: 1
+                  allOf:
+                    - if:
+                        properties:
+                          webhook_type:
+                            const: inbound_receiving
+                      then:
+                        required:
+                          - inbound_inbox_id
+                    - if:
+                        properties:
+                          webhook_type:
+                            not:
+                              const: inbound_receiving
+                      then:
+                        not:
+                          required:
+                            - inbound_inbox_id
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@specs/email-sending.openapi.yml` around lines 1670 - 1742, Add conditional
JSON Schema validation so inbound_inbox_id is required when webhook_type ==
"inbound_receiving" and forbidden for other webhook_type values: modify the
create webhook schema that defines properties webhook_type and inbound_inbox_id
to include a oneOf with two subschemas — one that matches webhook_type: {const:
"inbound_receiving"} and declares required: ["inbound_inbox_id"] (with
inbound_inbox_id typed as integer), and another that matches webhook_type values
excluding "inbound_receiving" and uses not: { required: ["inbound_inbox_id"] }
to forbid that property; reference the existing webhook_type and
inbound_inbox_id property names when adding these subschemas.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@specs/email-sending.openapi.yml`:
- Around line 1670-1742: Add conditional JSON Schema validation so
inbound_inbox_id is required when webhook_type == "inbound_receiving" and
forbidden for other webhook_type values: modify the create webhook schema that
defines properties webhook_type and inbound_inbox_id to include a oneOf with two
subschemas — one that matches webhook_type: {const: "inbound_receiving"} and
declares required: ["inbound_inbox_id"] (with inbound_inbox_id typed as
integer), and another that matches webhook_type values excluding
"inbound_receiving" and uses not: { required: ["inbound_inbox_id"] } to forbid
that property; reference the existing webhook_type and inbound_inbox_id property
names when adding these subschemas.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f370baf7-f61b-4843-83d2-d7eb5472ceb5

📥 Commits

Reviewing files that changed from the base of the PR and between 084714f and 3cff831.

📒 Files selected for processing (4)
  • .spectral.yaml
  • README.md
  • specs/email-sending.openapi.yml
  • specs/inbound.openapi.yml

@piobeny piobeny changed the title MT-22010 Inbound documentation Inbound documentation May 26, 2026
@piobeny piobeny merged commit 697f818 into main May 29, 2026
4 checks passed
@piobeny piobeny deleted the MT-22010-docs-update-documentation branch May 29, 2026 06:55
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.

4 participants