![Minddale](https://storage.googleapis.com/fcx-logos/minddale/Mindale-dark-tagline.png "Building digitally immortal brands!")


# Minddale


[Minddale](https://minddale.com) is a headless micro CRM provided by [Firecodex](https://firecodex.com) to help you build your brands digitally immortal!


## Library


This fcx-mindale-js (v1) is a JavaScript client library for Minddale, i.e. an npm library to get your JavaScript client connected to the platform and get the services done.


## Setup


This library is a very simple module added to your JavaScript project to use the service.


### Install


Run `cd your-app` & `npm i fcx-minddale-js --save`


### Use

Once registered with Minddale, get your API Key generated for a particular service to connect with the platform.


> Note: Make sure you keep the API Key securely in environment file or any other secure methods.


In case you are not making the request from your registered domain (website), make sure you are setting the registered client domain as well in the request header `x-mdl-domain`.


In order to publish either Newsletter or Contact JSON data, use the service methods as follows.


```

  // Setup Dependency & API Key

  const minddale = require('fcx-minddale-js');

  require('dotenv').config();
  const API_KEY = process.env.MDL_API_KEY;

  // Publish Newsletter

  let newsletter = {'recipient':"email@example.com", "tag":"home"};

  const response = minddale.newsletter.publishNewsletter(newsletter, API_KEY);
  response.then(resp=>console.log(resp));

  ...

  // Publish Contact

  let contact = {
    "email":"email@example.com", 
    "subject":"What are you upto?", 
    "message":"Would like to know how you can help me here.",
    "mobile":"+918888888888",
    "name":"Joe Dave"
  };

  const response = minddale.contact.publishContact(contact, API_KEY);
  response.then(resp=>console.log(resp));

```

## Support


We, at Firecodex, would like to support anybody with queries or suggestions. Please feel free to reach out to us:


> contact@firecodex.com


Happy Coding!