feat(whatsapp): redesign ack-reaction as whatsapp-specific feature
- Move config from messages.ackReaction to whatsapp.ackReaction
- New structure: {emoji, direct, group} with granular control
- Support per-account overrides in whatsapp.accounts.*.ackReaction
- Add Zod schema validation for new config
- Maintain backward compatibility with old messages.ackReaction format
- Update tests to new config structure (14 tests, all passing)
- Add comprehensive documentation in docs/providers/whatsapp.md
- Timing: reactions sent immediately upon message receipt (before bot reply)
Breaking changes:
- Config moved from messages.ackReaction to whatsapp.ackReaction
- Scope values changed: 'all'/'direct'/'group-all'/'group-mentions'
→ direct: boolean + group: 'always'/'mentions'/'never'
- Old config still supported via fallback for smooth migration
This commit is contained in:
committed by
Peter Steinberger
parent
d38b232724
commit
2daead27cf
@@ -169,6 +169,21 @@ export type WhatsAppConfig = {
|
||||
requireMention?: boolean;
|
||||
}
|
||||
>;
|
||||
/** Acknowledgment reaction sent immediately upon message receipt. */
|
||||
ackReaction?: {
|
||||
/** Emoji to use for acknowledgment (e.g., "👀"). Empty = disabled. */
|
||||
emoji?: string;
|
||||
/** Send reactions in direct chats. Default: true. */
|
||||
direct?: boolean;
|
||||
/**
|
||||
* Send reactions in group chats:
|
||||
* - "always": react to all group messages
|
||||
* - "mentions": react only when bot is mentioned
|
||||
* - "never": never react in groups
|
||||
* Default: "mentions"
|
||||
*/
|
||||
group?: "always" | "mentions" | "never";
|
||||
};
|
||||
};
|
||||
|
||||
export type WhatsAppAccountConfig = {
|
||||
@@ -202,6 +217,21 @@ export type WhatsAppAccountConfig = {
|
||||
requireMention?: boolean;
|
||||
}
|
||||
>;
|
||||
/** Acknowledgment reaction sent immediately upon message receipt. */
|
||||
ackReaction?: {
|
||||
/** Emoji to use for acknowledgment (e.g., "👀"). Empty = disabled. */
|
||||
emoji?: string;
|
||||
/** Send reactions in direct chats. Default: true. */
|
||||
direct?: boolean;
|
||||
/**
|
||||
* Send reactions in group chats:
|
||||
* - "always": react to all group messages
|
||||
* - "mentions": react only when bot is mentioned
|
||||
* - "never": never react in groups
|
||||
* Default: "mentions"
|
||||
*/
|
||||
group?: "always" | "mentions" | "never";
|
||||
};
|
||||
};
|
||||
|
||||
export type BrowserProfileConfig = {
|
||||
|
||||
@@ -1375,6 +1375,16 @@ export const ClawdbotSchema = z
|
||||
.optional(),
|
||||
)
|
||||
.optional(),
|
||||
ackReaction: z
|
||||
.object({
|
||||
emoji: z.string().optional(),
|
||||
direct: z.boolean().optional().default(true),
|
||||
group: z
|
||||
.enum(["always", "mentions", "never"])
|
||||
.optional()
|
||||
.default("mentions"),
|
||||
})
|
||||
.optional(),
|
||||
})
|
||||
.superRefine((value, ctx) => {
|
||||
if (value.dmPolicy !== "open") return;
|
||||
@@ -1421,6 +1431,16 @@ export const ClawdbotSchema = z
|
||||
.optional(),
|
||||
)
|
||||
.optional(),
|
||||
ackReaction: z
|
||||
.object({
|
||||
emoji: z.string().optional(),
|
||||
direct: z.boolean().optional().default(true),
|
||||
group: z
|
||||
.enum(["always", "mentions", "never"])
|
||||
.optional()
|
||||
.default("mentions"),
|
||||
})
|
||||
.optional(),
|
||||
})
|
||||
.superRefine((value, ctx) => {
|
||||
if (value.dmPolicy !== "open") return;
|
||||
|
||||
Reference in New Issue
Block a user