Skip to content

Fix webhook payload issues and release workflow hardening - #106

Open
mrb0nj wants to merge 2 commits into
masterfrom
feature/webhook-issue-cleanup
Open

Fix webhook payload issues and release workflow hardening#106
mrb0nj wants to merge 2 commits into
masterfrom
feature/webhook-issue-cleanup

Conversation

@mrb0nj

@mrb0nj mrb0nj commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • fix plain-text input serialization to emit the Slack multiline property
  • add nullable UnfurlLinks and UnfurlMedia options to SlackMessage
  • add implicit string to TextObject conversion for easier Block Kit composition
  • document Slack mention syntax and clarify legacy framework support
  • address CodeRabbit feedback from Simplify release workflow with NuGet trusted publishing #105 by pinning actions, disabling persisted checkout credentials, guarding tag releases to commits contained in master, and correcting package release notes

Issues

Validation

  • dotnet test src/Slack.Webhooks.sln --configuration Release
  • dotnet pack src/Slack.Webhooks/Slack.Webhooks.csproj --configuration Release --output /tmp/slack-webhooks-pack-test -p:PackageVersion=1.1.7 -p:ContinuousIntegrationBuild=true
  • git diff --check

Summary by CodeRabbit

  • New Features

    • Added link and media unfurling controls for Slack messages
    • Implicit conversion from string to text objects (simpler message construction)
    • Documentation example for Slack mention syntax (users, broadcasts, channels)
  • Documentation

    • Revised build badge, expanded changelog (v1.1.7-preview.1), and clarified download/compatibility guidance
  • Bug Fixes

    • Fixed JSON serialization name for plain-text multiline property
  • Tests

    • Added and updated unit tests covering text serialization and unfurl options
  • Chores

    • Hardened CI/publish workflow and pinned action versions

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 27278d9b-9501-4c13-8dc2-9845d87767eb

📥 Commits

Reviewing files that changed from the base of the PR and between db97a8d and a37d48e.

📒 Files selected for processing (3)
  • README.md
  • src/Slack.Webhooks/Elements/TextObject.cs
  • src/Slack.Webhooks/Slack.Webhooks.csproj
✅ Files skipped from review due to trivial changes (2)
  • README.md
  • src/Slack.Webhooks/Slack.Webhooks.csproj
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/Slack.Webhooks/Elements/TextObject.cs

📝 Walkthrough

Walkthrough

This PR delivers v1.1.6 with three core enhancements: unfurl controls for Slack message links/media, JSON property name correction for PlainTextInput multiline serialization, and implicit string-to-TextObject conversion. It includes CI workflow security updates with pinned action versions and release documentation reflecting the new features.

Changes

Slack Webhooks Features and Fixes

Layer / File(s) Summary
Unfurl options for link and media content
src/Slack.Webhooks/SlackMessage.cs, src/Slack.Webhooks.Tests/SlackMessageFixtures.cs
SlackMessage adds UnfurlLinks and UnfurlMedia nullable bool properties to control Slack's link/media unfurling behavior. Clone method preserves these properties. Tests verify serialization omits unfurl fields when unset and includes them with correct boolean values when set.
PlainTextInput multiline property JSON mapping
src/Slack.Webhooks/Elements/PlainTextInput.cs, src/Slack.Webhooks.Tests/PlainTextInputElementFixtures.cs
PlainTextInput.MultiLine property is annotated with [JsonProperty("multiline")] to serialize as multiline instead of multi_line, matching Slack API expectations. Import directive for Newtonsoft.Json added to support the attribute.
Implicit string-to-TextObject conversion operator
src/Slack.Webhooks/Elements/TextObject.cs, src/Slack.Webhooks.Tests/SectionBlockFixtures.cs
TextObject adds public static implicit operator allowing automatic conversion from string literals to TextObject instances. Test validates the operator works correctly with Section.Text assignment.
Docs and package metadata
README.md, src/Slack.Webhooks/Slack.Webhooks.csproj
README changelog updated (v1.1.7-preview.1 entry and compatibility notes), badge label changed, mention-syntax usage example added, and PackageReleaseNotes updated in the .csproj.

Release Infrastructure

Layer / File(s) Summary
GitHub Actions workflow version pinning and release validation
.github/workflows/main.yml
Build and publish jobs pin actions/checkout, actions/setup-dotnet, and NuGet/login to specific commit SHAs instead of version tags. Publish job adds full-history fetch and validates the workflow tag commit is an ancestor of origin/master before proceeding.

"A webhook's wish came true, three fixes so fine,
Unfurl and strings and JSON's true align!
🐰 The release hops forward, now v1.1.6 divine!"

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main changes: fixing webhook payload issues (multiline property, unfurl options) and hardening the release workflow (GitHub Actions pinning, credential controls, tag validation).
Linked Issues check ✅ Passed All coding requirements from linked issues #100, #94, and #85 are met: PlainTextInput.MultiLine now serializes as 'multiline', SlackMessage has UnfurlLinks/UnfurlMedia properties, and TextObject has implicit string conversion operator.
Out of Scope Changes check ✅ Passed All changes are within scope: workflow hardening (GitHub Actions pinning, tag verification) addresses CodeRabbit feedback; documentation updates clarify framework support and mention syntax; test fixtures validate new functionality.

✏️ 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 feature/webhook-issue-cleanup

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

@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

🧹 Nitpick comments (2)
src/Slack.Webhooks/Slack.Webhooks.csproj (1)

16-16: ⚡ Quick win

Release notes are missing one shipped feature.

Please include the implicit stringTextObject conversion in PackageReleaseNotes so NuGet metadata matches the release scope.

🤖 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 `@src/Slack.Webhooks/Slack.Webhooks.csproj` at line 16, Update the
<PackageReleaseNotes> XML value to include the shipped implicit string →
TextObject conversion so NuGet release metadata reflects that feature; locate
the <PackageReleaseNotes> element in the project file (the current text: "Adds
Slack webhook unfurl options, fixes plain-text input multiline serialization,
and keeps modern NuGet package metadata.") and append or integrate a short
phrase mentioning "implicit string → TextObject conversion" (or equivalent
wording) so the release notes enumerate that feature explicitly.
src/Slack.Webhooks/Elements/TextObject.cs (1)

63-66: 💤 Low value

Implicit operator correctly simplifies TextObject creation.

The operator allows TextObject obj = "text" and Section.Text = "text" assignments, addressing issue #85. The default Type = TextType.PlainText is a reasonable choice for plain string conversions.

Optional: Consider adding XML documentation

Adding an XML doc comment would clarify the default behavior for users:

+        /// <summary>
+        /// Implicitly converts a string to a <see cref="TextObject"/> with <see cref="Type"/> set to <see cref="TextType.PlainText"/>.
+        /// </summary>
         public static implicit operator TextObject(string text)
         {
             return new TextObject(text);
         }
🤖 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 `@src/Slack.Webhooks/Elements/TextObject.cs` around lines 63 - 66, Add an XML
documentation comment to the implicit conversion operator in TextObject to
document that implicitly converting from string constructs a new TextObject with
Type = TextType.PlainText and assigns the provided text; update the comment
above the operator method (the implicit operator in class TextObject) to clearly
state the default behavior and intended usage (e.g., "Enables assigning a string
to a TextObject or Section.Text; defaults to PlainText") so consumers and IDE
tooltips see the behavior.
🤖 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 `@README.md`:
- Around line 102-106: Update the mention guidance sentence to accurately
reflect the example by stating that Slack user, broadcast (here), and channel
mentions are supported; e.g., modify the text that precedes the code example
referencing slackMessage.Text and the sample string "<`@U12345678`> <!here>
<!channel>" so it explicitly includes channel mentions alongside user and
broadcast mentions.

---

Nitpick comments:
In `@src/Slack.Webhooks/Elements/TextObject.cs`:
- Around line 63-66: Add an XML documentation comment to the implicit conversion
operator in TextObject to document that implicitly converting from string
constructs a new TextObject with Type = TextType.PlainText and assigns the
provided text; update the comment above the operator method (the implicit
operator in class TextObject) to clearly state the default behavior and intended
usage (e.g., "Enables assigning a string to a TextObject or Section.Text;
defaults to PlainText") so consumers and IDE tooltips see the behavior.

In `@src/Slack.Webhooks/Slack.Webhooks.csproj`:
- Line 16: Update the <PackageReleaseNotes> XML value to include the shipped
implicit string → TextObject conversion so NuGet release metadata reflects that
feature; locate the <PackageReleaseNotes> element in the project file (the
current text: "Adds Slack webhook unfurl options, fixes plain-text input
multiline serialization, and keeps modern NuGet package metadata.") and append
or integrate a short phrase mentioning "implicit string → TextObject conversion"
(or equivalent wording) so the release notes enumerate that feature explicitly.
🪄 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 Plus

Run ID: 1292280f-0c84-4a7d-8335-cb9b92d00b24

📥 Commits

Reviewing files that changed from the base of the PR and between ea6dcd5 and db97a8d.

📒 Files selected for processing (9)
  • .github/workflows/main.yml
  • README.md
  • src/Slack.Webhooks.Tests/PlainTextInputElementFixtures.cs
  • src/Slack.Webhooks.Tests/SectionBlockFixtures.cs
  • src/Slack.Webhooks.Tests/SlackMessageFixtures.cs
  • src/Slack.Webhooks/Elements/PlainTextInput.cs
  • src/Slack.Webhooks/Elements/TextObject.cs
  • src/Slack.Webhooks/Slack.Webhooks.csproj
  • src/Slack.Webhooks/SlackMessage.cs

Comment thread README.md Outdated
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.

Unable to post plain text input Unfurling links in messages Add implicit type conversion from text to TextObject

1 participant