Repository navigation
Conversation
Decisions: - The topic is left out of campaign create and update requests unless set - Campaigns webhooks validate like the API: event types required, no sending stream - email_sending and campaigns webhooks share the event-types rule Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
|
@coderabbitai review |
Action not completed
|
|
@coderabbitai review |
Action not completed
|
Decisions: - The shared email_sending/campaigns EventTypes rule listed both types, so an email_sending caller got an error mentioning campaigns; the message now names the request's own type, as it did before campaigns webhooks were added. - Build the campaigns webhook test request in one helper instead of four times. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Decisions: - Pin the email_sending EventTypes message, which only the campaigns side covered - Keep the validator's tests in one fixture, as other resources do Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| /// Available only for <c>campaigns</c> webhooks and <c>email_sending</c> webhooks of the bulk stream; | ||
| /// the API rejects it for the transactional stream. | ||
| /// </remarks> | ||
| public static readonly WebhookEventType SubscriptionPreferencesUpdate = Define("subscription_preferences_update"); |
There was a problem hiding this comment.
[should] The live API doesn't accept subscription_preferences_update yet – it quietly drops event types it doesn't know. So today a campaigns webhook created with delivery and this event comes back with only delivery, a webhook with just this event gets a 422 "can't be blank", and a transactional webhook isn't refused. Could you hold this value and the example lines that use it until the API change that adds the event is live, or release them separately from the campaign topic and the campaigns type, which already work?
| .WithMessage("'SendingStream' must not be set for 'campaigns' webhook type."); | ||
| }); | ||
|
|
||
| When(r => r.WebhookType == WebhookType.EmailSending || r.WebhookType == WebhookType.Campaigns, () => |
There was a problem hiding this comment.
[could] No test covers the email_sending half of this condition. I dropped r.WebhookType == WebhookType.EmailSending || and every unit and integration test still passed, so an email_sending webhook without event types (and the new interpolated message) isn't checked anywhere. A case next to Validate_CampaignsWebhookWithoutEventTypes_ShouldFail for email_sending would cover it.
| /// </value> | ||
| /// | ||
| /// <remarks> | ||
| /// For an account without subscription topics, the API ignores this field. |
There was a problem hiding this comment.
[nitpick] The API ignores this field only when subscription topics aren't enabled for the account. An account that has the feature but no topic with this ID gets a 422 "does not exist", so "an account without subscription topics" reads wrong for that case. The same sentence is in UpdateEmailCampaignRequest.
mklocek
left a comment
There was a problem hiding this comment.
LGTM. +1 to @oshchyhol on not releasing subscription_preferences_update before the API accepts it. Small one: subscription_topic_id on campaigns isn't in mailtrap-openapi yet either, so it'd be good to land it in the spec before the release so docs and the other SDKs line up.
|
@coderabbitai review |
Action not completed
|
Motivation
With subscription topics, a campaign can be sent under a topic, and the API adds a
campaignswebhook type and asubscription_preferences_updatewebhook event. This brings both to the .NET SDK.It builds on #271 (the Subscription Topics API), which the campaign example uses to pick a topic.
Changes
subscription_preferences_updateevent and thecampaignswebhook type, which requires event types and takes no sending streamHow to test
You'll need API tokens for two accounts: one with subscription topics (at least one topic, a verified sending domain and a draft campaign) and one without.
Campaigns
SubscriptionTopicIdset to a topic covering its domain; the response returns it, and a laterGetDetailstooWebhooks
campaignswebhook withdeliveryandsubscription_preferences_update: it is created and lists both event typessubscription_preferences_updateon a transactionalemail_sendingwebhook: the API answers 422Examples
PR Train
mainSplit out of the same change but outside this train, targeting
mainon its own: #274 (email-log topic events and topic unsubscriptions in suppressions).