fix: normalize WhatsApp targets for groups and E.164 (#631) (thanks @imfing)

This commit is contained in:
Xin
2026-01-10 00:07:09 +00:00
committed by Peter Steinberger
parent a6822e1210
commit f0700e9778
8 changed files with 181 additions and 13 deletions

View File

@@ -126,6 +126,36 @@ describe("resolveHeartbeatDeliveryTarget", () => {
});
});
it("keeps WhatsApp group targets even with allowFrom set", () => {
const cfg: ClawdbotConfig = {
whatsapp: { allowFrom: ["+1555"] },
};
const entry = {
...baseEntry,
lastProvider: "whatsapp" as const,
lastTo: "120363401234567890@g.us",
};
expect(resolveHeartbeatDeliveryTarget({ cfg, entry })).toEqual({
provider: "whatsapp",
to: "120363401234567890@g.us",
});
});
it("normalizes prefixed WhatsApp group targets for heartbeat delivery", () => {
const cfg: ClawdbotConfig = {
whatsapp: { allowFrom: ["+1555"] },
};
const entry = {
...baseEntry,
lastProvider: "whatsapp" as const,
lastTo: "whatsapp:group:120363401234567890@G.US",
};
expect(resolveHeartbeatDeliveryTarget({ cfg, entry })).toEqual({
provider: "whatsapp",
to: "120363401234567890@g.us",
});
});
it("keeps explicit telegram targets", () => {
const cfg: ClawdbotConfig = {
agents: { defaults: { heartbeat: { target: "telegram", to: "123" } } },