whatsapp-web.js
whatsapp-web.js copied to clipboard
fix(vcard): parse vcard module
PR Details
Fix for vCard parsing.
Description
Modules and their function that are responsible for parsing vCards were updated.
Related Issues
closes #1994 closes #2680
Motivation and Context
The vCard was not display, the content of the vCard was sent to Whatsapp chat.
How Has This Been Tested
Tested with a Bot, the vCard is now generated and displayed properly in Whatsapp.
// client initialization...
client.on('ready', async () => {
const userId = '[email protected]';
const vCard =
'BEGIN:VCARD\n' +
'VERSION:3.0\n' +
'FN:John Doe\n' +
'ORG:Microsoft;\n' +
'TEL;type=CELL;type=VOICE;waid=18006427676:+1 (800) 642 7676\n' +
'END:VCARD';
await client.sendMessage(userId, vCard);
});
Types of changes
- [ ] Dependency change
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist
- [X] My code follows the code style of this project.
- [ ] I have updated the documentation accordingly (index.d.ts).
#1994
closes #1994
thanks
Should this be working with multiple cards?
Remove all formatting changes
@CyrilLacroix
Installing npm install git+https://github.com/CyrilLacroix/whatsapp-web.js.git
get a
TypeError: data.id.id.substring is not a function
When is it going to be merge to master?
Where we standing with this?
When this pull merge it? It works flawlessly @PurpShell @tuyuribr @shirser121
@alechkos
I tested its work
Didn´t work to me
I tested the change and confirm that it fixes the problem.
vcardGetNameFromParsed is no longer usable, I have switched to parsed.N[0].value.join(' ').trim()
vcardGetNameFromParsed is no longer usable, I have switched to parsed.N[0].value.join(' ').trim()
Can you share all the code changes need to be placed?
vcardGetNameFromParsed is no longer usable, I have switched to parsed.N[0].value.join(' ').trim()
Can you share all the code changes need to be placed?
src/util/Injected.js in line 270:
const parsed = window.Store.VCardParse.parseVcard(content);
if (parsed) {
vcardOptions = {
type: 'vcard',
vcardFormattedName: parsed.N[0].value.join(' ').trim()
};
}
src/util/Injected.js in line 270:
const parsed = window.Store.VCardParse.parseVcard(content);
if (parsed) {
vcardOptions = {
type: 'vcard',
vcardFormattedName: parsed.N[0].value.join(' ').trim()
};
}
thx but it still doesnt work at least for me. any other way to rectify the issue?
how do I solve this, please explain what needs to be replaced.
any ETA on this?