WhatsApp: handle contact cards inbound
This commit is contained in:
committed by
Peter Steinberger
parent
875c62689e
commit
30b3d6ce61
@@ -28,6 +28,36 @@ describe("web inbound helpers", () => {
|
||||
expect(body).toBe("doc");
|
||||
});
|
||||
|
||||
it("extracts WhatsApp contact cards", () => {
|
||||
const body = extractText({
|
||||
contactMessage: {
|
||||
displayName: "Ada Lovelace",
|
||||
vcard: [
|
||||
"BEGIN:VCARD",
|
||||
"VERSION:3.0",
|
||||
"FN:Ada Lovelace",
|
||||
"TEL;TYPE=CELL:+15555550123",
|
||||
"END:VCARD",
|
||||
].join("\n"),
|
||||
},
|
||||
} as unknown as import("@whiskeysockets/baileys").proto.IMessage);
|
||||
expect(body).toBe("<contact: Ada Lovelace, +15555550123>");
|
||||
});
|
||||
|
||||
it("extracts multiple WhatsApp contact cards", () => {
|
||||
const body = extractText({
|
||||
contactsArrayMessage: {
|
||||
contacts: [
|
||||
{ displayName: "Alice" },
|
||||
{ displayName: "Bob" },
|
||||
{ displayName: "Charlie" },
|
||||
{ displayName: "Dana" },
|
||||
],
|
||||
},
|
||||
} as unknown as import("@whiskeysockets/baileys").proto.IMessage);
|
||||
expect(body).toBe("<contacts: Alice, Bob, Charlie +1 more>");
|
||||
});
|
||||
|
||||
it("unwraps view-once v2 extension messages", () => {
|
||||
const body = extractText({
|
||||
viewOnceMessageV2Extension: {
|
||||
|
||||
Reference in New Issue
Block a user