Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vcard): parse vcard module #1995

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

CyrilLacroix
Copy link

@CyrilLacroix CyrilLacroix commented Feb 12, 2023

PR Details

Fix for vCard parsing.

Description

Modules and their function that are responsible for parsing vCards were updated.

Related Issues

closes #1994 closes #2327 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
  • 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

  • My code follows the code style of this project.
  • I have updated the documentation accordingly (index.d.ts).

@tuyuribr tuyuribr added the waiting for testers Waiting for other people test this PR in other envs label Feb 12, 2023
@tofers
Copy link
Contributor

tofers commented Feb 12, 2023

#1994

@purpshell
Copy link
Collaborator

closes #1994

@purpshell purpshell linked an issue Feb 13, 2023 that may be closed by this pull request
1 task
@RC047
Copy link
Contributor

RC047 commented Feb 14, 2023

thanks

@tofers tofers mentioned this pull request Feb 19, 2023
1 task
@nathanfinger
Copy link

Should this be working with multiple cards?

Copy link
Collaborator

@tuyuribr tuyuribr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make ESList god happy

Copy link
Contributor

@themazim themazim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, works on ios, android and web.

@purpshell
Copy link
Collaborator

Remove all formatting changes

@frnndwrms
Copy link

@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?

@CyrilLacroix CyrilLacroix requested a review from tuyuribr July 6, 2023 06:52
@shirser121
Copy link
Collaborator

Where we standing with this?

@RC047
Copy link
Contributor

RC047 commented Aug 12, 2023

When this pull merge it? It works flawlessly @purpshell @tuyuribr @shirser121

Copy link
Contributor

@RC047 RC047 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested its work

@RC047

This comment was marked as off-topic.

@RC047 RC047 mentioned this pull request Dec 12, 2023
1 task
@joweste
Copy link

joweste commented Dec 22, 2023

I tested its work

Didn´t work to me

@alechkos alechkos removed the waiting for a response Waiting for a response from the author of an issue or a PR label Jan 17, 2024
@alechkos alechkos requested review from shirser121 and tuyuribr and removed request for tuyuribr January 17, 2024 03:29
@aksiuwaa

This comment was marked as outdated.

@RemyBoy72
Copy link

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?

1 similar comment
@videjunior

This comment was marked as duplicate.

@aksiuwaa

This comment was marked as outdated.

@RemyBoy72

This comment was marked as outdated.

@raisa875647
Copy link

how do I solve this, please explain what needs to be replaced.

@poislagarde
Copy link

any ETA on this?

@khsoh
Copy link

khsoh commented Aug 12, 2024

Can this patch be modified to work on v1.25.0 ?

@alechkos alechkos removed the waiting for testers Waiting for other people test this PR in other envs label Oct 2, 2024
@alechkos alechkos requested review from tuyuribr and removed request for tuyuribr October 2, 2024 02:27
@khsoh
Copy link

khsoh commented Oct 3, 2024

Hi, I have tested this patch and it works except when the VCARD contains an EMAIL entry. For example, in the example.js file, replace the vCard:

const vCard =
            'BEGIN:VCARD\n' +
            'VERSION:3.0\n' +
            'FN:John Doe\n' +
            'ORG:Microsoft;\n' +
            'EMAIL;type=INTERNET:[email protected]\n' +
            'TEL;type=CELL;type=VOICE;waid=18006427676:+1 (800) 642 7676\n' +
            'END:VCARD';

It will not work. One way to fix this is to replace lines 139-142 of Utils.js with:

        vcardOptions = {
            type: 'vcard',
            subtype: null,
            vcardFormattedName: window.Store.VCardUtils.vcardGetNameFromParsed(parsed)
        };

@alechkos
Copy link
Collaborator

alechkos commented Oct 3, 2024

@khsoh Thank you!

khsoh added a commit to khsoh/whatsapp-web.js that referenced this pull request Oct 4, 2024
@Maimbe

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Not able to send Contact Send VCard of business account Bug when sending contact messages