Code Monkey home page Code Monkey logo

node-mautic's People

Contributors

bucherfa avatar dependabot[bot] avatar gramakri avatar leog avatar pushparajsamant avatar r3volut1oner avatar si4dev avatar syrok avatar theavijitsarkar avatar vdavid avatar vettloffah avatar wfulgenzi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-mautic's Issues

Mautic 3

Are there any known issues with using Mautic 3? I've been doing some testing and my api calls are failing with a "SyntaxError: Unexpected token < in JSON at position 0"
I'm not sure if that has anything to do with this library, but I thought I would reach out to check.

Mautic API Error with no additional information

Hi there, I'm running into the error

MAUTIC | Mautic API error. | 
 Error: MAUTIC | Mautic API error. | 
at MauticConnector._callApi (/Users/djshine/Desktop/Side/cm-master/node_modules/node-mautic/MauticConnector.js:97:19)
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:229:7)

When making any API call, I have tried to change the logLevel to both error and 'verbose' and I don't receive any other log information on what this error is. I'm guessing this is related with the authentication since none of the requests are working - i'm positive the config is correct in terms of the mautic domain and the username and password

Here is a safe version of the MauticConnector object:

const mauticConnector = new MauticConnector({ apiUrl: "https://mautic.chosenmasters.com", username: "dj", password: "123456", enableErrorLogging: true, logLevel: 'error' });

I am trying this from localhost would that make any difference?

I appreciate any help, thanks!

Connection issue

Hello @vdavid

I am trying to connect mautic through API but not successful. Can you please help?

I also used axios to test but not successful. The only thing it works is to make request via curl.

curl -v -X GET https://username:password@--url--

Below is my code

const mauticConnector = require('node-mautic');

let mautic = new mauticConnector({
    apiUrl: "--url--",
    username: "username",
    password: "password",
    timeoutInSeconds: 10
})

mautic.contacts.listContacts().then((res) => {
    
    console.log("Successful")
    console.log(res)

}).catch((err) => {
    console.log("Error: " + err)
})

Here is the response:

Error: FetchError: request to https://-- url --/api/contacts failed, reason: connect ECONNREFUSED 174.138.0.0:443

Thank you

Problem get data method listContacts

Dear good morning when I try to use the method to list the contacts (listContacts), it only returns the id, but not all the information, such as name, surname, etc.

image

Values fields.all

image

I would appreciate if you can help find a solution.
Thanks!

Version mismatch against v1.1.0

I'm confused. https://www.npmjs.com/package/node-mautic states the project version is 1.1.0.
Installing using npm install node-mautic does, in fact, install a version 1.1.0.
An examination of the node_modules/node-mautic package.json file does indeed show version 1.1.0 as the last line in the package.json file. It has a single dependency: node-fetch.

All good. HOWEVER. The github repo that nodejs.com points to (this repo) contains a tip package.json with a version number of 1.0.3. (on line 3). The dependency listed is for request instead of node-fetch.

What am I missing. I'm looking for the source code for 1.1.0 and I'm not finding it.

Error log throws error mapping errors

Is it possible to add a config flag of maybe verbose or debug to prevent console logs?

It's also currently causing an error due to the .map failing on the error object.

Quick fix would be to add multiple options but this could be made even safer with a type check before attempting to map.

const logMessage = 'MAUTIC | Mautic API error. | ' + (body.errors || result.errors || []).map(error => error.code + ': ' + error.message).join(', ');
console.log(logMessage);
throw new Error(logMessage);

Currently, I've just wrapped all requests in a try/catch to prevent bubbling up the stack, but this means I lose any context about an error which is not ideal.

Getting user using the email

Hi,
I don't know if it is a bug or not but getContactByEmailAddress seems not working in my side. It returns the full contacts list.

my code :

   const email = await mauticConnector.contacts.getContactByEmailAddress(
      'email:myemail'
    );

I tried using postman to call my server directly with /api/contacts?search=myemail and I got the right data

Mautic: v2.16.2

Thanks in advance

Replace node-fetch with fetch from Node 18

Hi David
First of all, thank you for your package!

With Node 18, fetch is native built in. I know, this would be breaking change to replace it, but as Node 18 is now the current LTS, it would be an option to think about it…

`overwriteWithBlank` cannot be set to `false`

Hi David,

Thank you for maintaining and making available this package. It's very helpful.

We found that in some cases for the editing contact request /PATCH /contacts/ID/edit we would like to turn off the optional overwiteWithBlank parameter. Currently this is not supported with the editContact method because it is always set to true and overrides any supplied arguments, even if one explicitly sets overwriteContact: false. See line:

editContact: (method, queryParameters, contactId) => this._callApi({method: this._ensureMethodIsPutOrPatch(method), url: this._makeUrl('/contacts/' + contactId + '/edit'), body: JSON.stringify(this._httpQueryHelper.removeUndefinedValues({...queryParameters, overwriteWithBlank: true}))}),

I tried to create a Pull request on a new feature branch but was unable to push that to the repo to submit the PR. Please let me know if there's anything I can do for that. Thanks !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.