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

Link via phone number instead of QR #1687

Open
YosefAdPro opened this issue Jan 18, 2024 · 7 comments
Open

Link via phone number instead of QR #1687

YosefAdPro opened this issue Jan 18, 2024 · 7 comments
Labels
enhancement New feature or request needs triage

Comments

@YosefAdPro
Copy link
Contributor

wppconnect-team/wppconnect#2031

@YosefAdPro YosefAdPro added enhancement New feature or request needs triage labels Jan 18, 2024
@Saifallak
Copy link
Contributor

Saifallak commented Mar 11, 2024

Next release of @wppconnect-server

ref: wppconnect-team/wppconnect#1921 (comment)

@aymansyam
Copy link

is this as simple as adding this in createSessionUtil()?

phoneNumber: client.config?.phoneNumber,

I've tried it locally but it doesn't return the link code for some reason :(

Also, a new route similar to POST /qrcode-session which gets you the link code would be nice.

@icleitoncosta
Copy link
Collaborator

is this as simple as adding this in createSessionUtil()?

phoneNumber: client.config?.phoneNumber,

I've tried it locally but it doesn't return the link code for some reason :(

Also, a new route similar to POST /qrcode-session which gets you the link code would be nice.

So that's one way. At the moment we have not yet implemented it in a standard way on the server, it will soon be implemented in the next release.


      const wppClient = await create(
        Object.assign(
          {},
          { tokenStore: myTokenStore },
          req.serverOptions.createOptions,
          {
            session: session,
            phoneNumber: '5521999999999',
            deviceName:
              client.config?.deviceName || req.serverOptions.deviceName,
            poweredBy:
              client.config?.poweredBy ||
              req.serverOptions.poweredBy ||
              'WPPConnect-Server',
[...code....]

@aymansyam
Copy link

With the newest release, I tried the above but still it doesn't output the code in the terminal.

After some debugging I found that it gets stuck in evaluateAndReturn:

  protected async loginByCode(phone: string) {
    const code = await evaluateAndReturn(
      this.page,
      async ({ phone }) => {
        return JSON.parse(
          JSON.stringify(await WPP.conn.genLinkDeviceCodeForPhoneNumber(phone))
        );
      },
      { phone }
    );

For some reason, when the wppconnect is ran through wppconnect-server, WPP.conn.genLinkDeviceCodeForPhoneNumber does not return at all. It's weird because wppconnect by itself does return the code, so this may be a configuration issue on wppconnect-server.

@aymansyam
Copy link

Hi, is this feature still gonna get added?

@jaygent
Copy link

jaygent commented May 7, 2024

With the newest release, I tried the above but still it doesn't output the code in the terminal.

After some debugging I found that it gets stuck in evaluateAndReturn:

  protected async loginByCode(phone: string) {
    const code = await evaluateAndReturn(
      this.page,
      async ({ phone }) => {
        return JSON.parse(
          JSON.stringify(await WPP.conn.genLinkDeviceCodeForPhoneNumber(phone))
        );
      },
      { phone }
    );

For some reason, when the wppconnect is ran through wppconnect-server, WPP.conn.genLinkDeviceCodeForPhoneNumber does not return at all. It's weird because wppconnect by itself does return the code, so this may be a configuration issue on wppconnect-server.

did you manage to find a solution to the problem?

This is the only way getting the code works

const wppClient = await create({
        session: session,
        phoneNumber: '55555555555',
        catchLinkCode: (code: string) => {
          console.log(code);
        },
        autoClose: 1000000,
      });

@jaygent
Copy link

jaygent commented May 7, 2024

if you delete this

deviceName:
              client.config?.deviceName || req.serverOptions.deviceName,
            poweredBy:
              client.config?.poweredBy ||
              req.serverOptions.poweredBy ||
              'WPPConnect-Server',

then everything works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs triage
Projects
None yet
Development

No branches or pull requests

5 participants