GithubHelp home page GithubHelp logo

sambarnes90 / node-mautic Goto Github PK

View Code? Open in Web Editor NEW
16.0 2.0 8.0 25 KB

Node.js wrapper for the Mautic API

License: GNU General Public License v3.0

JavaScript 100.00%
nodejs mautic mautic-api

node-mautic's People

Contributors

sambarnes90 avatar

Stargazers

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

Watchers

 avatar  avatar

node-mautic's Issues

Another package that might interest you

Hey @sambarnes90

I've just finished a bit more up-to-date and more complete Node.js package for Mautic: https://github.com/vdavid/node-mautic

I've started from your code base (I did a bunch of replaces to reformat the API call functions) so I'd like to thank you for your work! Sorry for not forking the repo, I didn't originally intend to publish my package, I've created it for my company, but then I thought, why not, it might be helpful for others too.

If you think my package might help people, please consider recommending it in your README.md so that they have an easier time finding (and perhaps contributing to) it.

Thanks :)
David

More samples - example.js only has a simple get contact by id

Just posting these examples of other operations for contacts (search, create, update) here for others (and my future) reference ๐Ÿ˜‰

var print_result = function (result) {
  // Pretty print the JSON result
  console.log(JSON.stringify(result, null, "  "));
};

var test_get = function(config){
  var contactId = 35944;
  mautic.contacts.getContact(config,contactId,print_result);
}

var test_list = function(config){
  // These search parameters seem not well documented... maybe dig more:
  // https://github.com/mautic/mautic/issues?q=is%3Aissue+search+parameter
  var email = "[email protected]";
  mautic.contacts.listContacts(config,{ "search":"email:"+email },print_result);

  // e.g. /api/contacts?search=firstname:Jeff
  mautic.contacts.listContacts(config,{ "search":"firstname:Jeff" },print_result);
}

var test_create = function(config){
  new_contact = {
    'firstname':'Asdf',
    'lastname':'Wxyz',
    'email':'[email protected]',
    'ipAddress':'127.0.0.1',
    "some_custom_field":"foo"
  };
  mautic.contacts.createContact(config,new_contact,print_result);
};

var test_update = function(config)
{
  var contactId = 35944;
  mautic.contacts.editContact(config,"PATCH",{ email:"[email protected]" },contactId,print_result)
};

var test_update_by_email = function(config)
{
  var email = "[email protected]";
  mautic.contacts.listContacts(config,{ "search":"email:"+email },function(result) {
    if (result && result.total=="1" && result.contacts) {
      var contactId = Object.keys(result.contacts)[0];
      mautic.contacts.editContact(config,"PATCH",{
        "my_custom_string_field": "foo",
        "my_custom_date_field": new Date("Jan 2, 2013").toISOString()
      },contactId,print_result)
    } else {
      console.log('Lookup failed by email: '+email);
    }
  });
};

Example for Post Request

Hi sambarnes90,

I am trying to use your wrapper for the Mautic API which works well so far. I am now having problems doing any POST request. I am trying to create a DynamicContent asset with the API but it does not work. It seems that I am creating the bodyParameters wrong.

I've created a stack overflow question for this (https://stackoverflow.com/questions/51320765/mautic-api-cannot-create-dynamiccontent) because I am quite sure, this is my mistake not understanding it.

It would help a lot if you could put an example for creating data (dynamic content, contacts, ...) in this repo.

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.