@sendinel/mcp-server 1.0.38 → 1.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/tools/campaigns.js +29 -0
- package/package.json +1 -1
package/build/tools/campaigns.js
CHANGED
|
@@ -305,6 +305,33 @@ async function executeBroadcast(input) {
|
|
|
305
305
|
}
|
|
306
306
|
return { ok: true, campaignId: campaign.id, stepId: step.id, enrolled: input.contactIds.length, nextSendAt };
|
|
307
307
|
}
|
|
308
|
+
/** #3714: a send nobody could receive leaves one audit row (counts by reason, no addresses). */
|
|
309
|
+
function logRefusedSend(kind, siteId, sendClass, audience, extra = {}) {
|
|
310
|
+
const reasons = {};
|
|
311
|
+
if (audience.notOnSender > 0)
|
|
312
|
+
reasons.not_subscribed_to_sender = audience.notOnSender;
|
|
313
|
+
for (const [reason, count] of Object.entries(audience.heldBack)) {
|
|
314
|
+
if (count > 0)
|
|
315
|
+
reasons[`consent_${reason}`] = count;
|
|
316
|
+
}
|
|
317
|
+
return logAudit({
|
|
318
|
+
action: 'send.refused',
|
|
319
|
+
resourceType: 'site',
|
|
320
|
+
resourceId: siteId,
|
|
321
|
+
details: {
|
|
322
|
+
kind,
|
|
323
|
+
outcome: 'nothing_sent',
|
|
324
|
+
send_class: sendClass,
|
|
325
|
+
site_id: siteId,
|
|
326
|
+
campaign_id: null,
|
|
327
|
+
requested: audience.matched,
|
|
328
|
+
enrolled: 0,
|
|
329
|
+
refused: Object.values(reasons).reduce((sum, count) => sum + count, 0),
|
|
330
|
+
reasons,
|
|
331
|
+
...extra,
|
|
332
|
+
},
|
|
333
|
+
});
|
|
334
|
+
}
|
|
308
335
|
function heldBackLines(audience) {
|
|
309
336
|
return {
|
|
310
337
|
matched: audience.matched,
|
|
@@ -909,6 +936,7 @@ export function registerCampaignTools(server) {
|
|
|
909
936
|
});
|
|
910
937
|
}
|
|
911
938
|
if (contactIds.length === 0) {
|
|
939
|
+
await logRefusedSend('broadcast_to_segment', site_id, 'broadcast', audience, { audience: { segment_id } });
|
|
912
940
|
return j({
|
|
913
941
|
error: 'Nobody in this segment can get email from this sender right now.',
|
|
914
942
|
code: 'EMPTY_SEGMENT',
|
|
@@ -1153,6 +1181,7 @@ export function registerCampaignTools(server) {
|
|
|
1153
1181
|
return j({ error: `Could not load this audience: ${error instanceof Error ? error.message : String(error)}`, code: 'AUDIENCE_LOOKUP_FAILED' });
|
|
1154
1182
|
}
|
|
1155
1183
|
if (resolved.contactIds.length === 0) {
|
|
1184
|
+
await logRefusedSend('send_broadcast', site.id, sendClass, resolved, { audience: segment_id ? { segment_id } : { inline_rules: true } });
|
|
1156
1185
|
return j({ error: 'Nobody in this audience can get this email from this sender.', code: 'EMPTY_AUDIENCE', audience: heldBackLines(resolved), rules });
|
|
1157
1186
|
}
|
|
1158
1187
|
let content;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sendinel/mcp-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.39",
|
|
4
4
|
"description": "AI-controlled email operations control plane for campaigns, contacts, segments, analytics, and multi-provider sending via MCP.",
|
|
5
5
|
"mcpName": "ai.sendinel/mcp-server",
|
|
6
6
|
"type": "module",
|