Coder Social home page Coder Social logo

moosend-fdw's Introduction

MoosendFDW

A Multicorn-based foreign data wrapper for the Moosend API.

Why? Because I want to control my mailing lists from postgresql; because I want postgresql to be my API; because Graphile makes it possible for me to design a database model and use it as my API.

Install

Assuming you have the Multicorn extension and python setuptools installed on your Postgresql server, run the following to install this module:

git clone https://github.com/mdiin/moosend-fdw
cd moosend-fdw
sudo python setup.py install

Following that, restart your postgresql server to make the module accessible.

Usage

To create the foreign data wrapper server:

CREATE SERVER moosend
FOREIGN DATA WRAPPER multicorn
OPTIONS (
  wrapper 'moosendfdw.SubscriberFDW'
);

To create a foreign table using this server:

CREATE FOREIGN TABLE moosend_subscribers (
  "ID" TEXT COMMENT 'Maps directly to the ID property in Moosend',
  "Email" TEXT COMMENT 'Maps directly to the Email property in Moosend',
  "Name" TEXT COMMEN 'Maps directly to the Name property in Moosend',
  "CreatedOn" TIMESTAMP WITH TIME ZONE COMMENT 'Maps directly to the CreatedOn property in Moosend',
  "MyCrazyNumber" INTEGER COMMENT 'Maps to the MyCrazyNumber custom field on the mailing list'
)
SERVER moosend
OPTIONS (
  api_key 'your_api_key',
  list_id 'your_list_id'
)

Now all your list subscribers are but a SELECT away:

SELECT * FROM moosend_subscribers;

And you can INSERT, UPDATE, and DELETE as on a regular table.

Column names

Column names of your foreign table that do not match a Moosend-internal field are assumed to be custom fields in the terminology of Moosend. What this means is that your table's columns for e.g. subscriber email must match what the Moosend API calls them.

See the Moosend Subscribers API documentation for details on the column names.

A note on subscriber consent

When inserting a subscriber using this foreign data wrapper the assumption is that you have received an opt-in confirmation from somewhere other than Moosend.

Authors

  • Matthias Varberg Ingesman - Initial work - mdiin

See also the list of contributers who participated in this project.

License

This project is licensed under the MIT license - see the LICENSE file for details.

Acknowledgments

  • Multicorn for building an amazing framework for Postgresql foreign data wrappers
  • Moosend for being a friendly email service

moosend-fdw's People

Contributors

mdiin avatar

Watchers

 avatar

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.