UNPKG

fcx-minddale-ts

Version:

TypeScript client SDK for the headless micro CRM, Minddale.

112 lines (48 loc) 2.36 kB
![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-ts --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. ``` // Import Service and Models import { ContactClient, NewsletterClient, Contact, Newsletter } from 'fcx-minddale-ts'; import dotenv from 'dotenv'; ... dotenv.config(); const apiKey = process.env.MDL_API_KEY; ... // Publish Newsletter public async publishNewsletter() { if(this.email) { const newsletterClient =new NewsletterClient(apiKey); let message = await newsletterClient.publishNewsletter({recipient: this.email, tag: "home"} as Newsletter); alert(message); }else { alert('Please enter valid email to subscribe!'); } } ... // Publish Contact public async publishContact() { if(this.email && this.subject && this.message) { const contactClient =new ContactClient(apiKey); let status = await contactClient.publishContact({email: this.email, subject: this.subject, message: this.message, name: this.name} as Contact); alert(status); }else { alert('Please enter valid contact info to post!'); } } ``` ## 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!