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

updateContact() doesn't support indentifierType #43

Open
jedgrant opened this issue Nov 20, 2024 · 1 comment
Open

updateContact() doesn't support indentifierType #43

jedgrant opened this issue Nov 20, 2024 · 1 comment

Comments

@jedgrant
Copy link

When referring to the API documentation, the tool that allows you to test the API calls shows you that you can use indentifierType to tell the API what kind of an ID is being used. However, when using the node library, there appears to be no way to do this. I manually edited the library to work for me with the following code:

updateContact(identifier, identifierType = null, updateContact, options = { headers: {} }) {
        return __awaiter(this, void 0, void 0, function* () {
            // changed to let
            let localVarPath = this.basePath + '/contacts/{identifier}'
                .replace('{' + 'identifier' + '}', encodeURIComponent(String(identifier)));
           // new code
            if (identifierType) {
                localVarPath += '?identifierType='+identifierType;
            }
            // ...remaining code
      })
  }

And created a new type that covers the identifier types that matter to me (But not all the API supports)

export declare type IdentifierType = "ext_id" | "email_id" | "phone_id" | "contact_id";

I'm not familiar with how to do pull requests. Hope this is somewhat helpful.

@julienlebren
Copy link

julienlebren commented Nov 22, 2024

I am facing the same problem.

Of course the code of this package cannot work, due to the encodeURIComponent function that also encodes the '?' and '=' in the identifier when we pass ?identifierType=xxx...
It seems that Brevo developers did not test anything before release this package, it is full of bugs.

Unfortunately, for me it does not work even with the code you added.
I try to use the ext_id attribute, but the server replies Contact does not exist (even if, of course, the contact exists...)
If I use the contact_id attribute, it works. So this is not only a bug in this package, but on Brevo serverside...

This is not the first bug I mention in this package, but it seems this is a dead package, nobody replies to the issues.
The only thing working fine with Brevo is the monthly subscription debit, no problem with this...

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

No branches or pull requests

2 participants