GithubHelp home page GithubHelp logo

angular-mailchimp-subscribe's People

Contributors

cgarnier avatar godfredakpan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

angular-mailchimp-subscribe's Issues

Requires Ng-Resource

The documentation for this module does not state that ng-resource is required. Please include it in documentation/READ.me.

Mailchimp 2.0 Api

Hi

I want to pick your brain a bit.

In angular api 2.0 they are expecting a structure for email and merge_vars.

Your code amended as follows but the api still returns an error
"status":"error","code":-100,"name":"ValidationError","error":"Validation error: {"email":"Please enter a struct\/associative array","merge_vars":"Please enter a struct\/associative array"}"}

.provider('CgMailChimpService', function () {
var config = { username: '', dc: '', u: '', id: '' };

    this.setConfig = function (cfg) {
        config = cfg;
    };

    this.$get = function ($http, $q) {

        var url = 'https://' + config.dc + '.api.mailchimp.com/2.0/lists/subscribe';
        var params = [];

        return {
            subscribe: function (data) {
                var defer = $q.defer();
                var params = angular.extend({}, {
                        apikey: config.u,
                        id: config.id,
                        email: [{
                            email: data.EMAIL,
                            euid: '1',
                            leid: '2'

                        }],
                        merge_vars: [{
                            FNAME: data.FNAME,
                            LNAME: data.SNAME

                        }],
                        email_type: "html",
                        send_welcome: true
                    }    )       
                ;
                $http({
                    url: url,
                    params: params,
                    method: 'JSONP',

                }).then(function (data) {
                    if (data.data.result === 'success')
                        defer.resolve(data.data);
                    else
                        defer.reject(data.data);

                }, function (err) {
                    defer.reject(err)
                });

                return defer.promise;
            }
        }
    }
});

Security

How secure is this approach to use mailchimp? With API key anybody can do what they want. If they could just add emails that would not be so terrible, but I believe they can also remove existing emails and so on?

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.