Entries Tagged '3rd Party List Integration' ↓

DAP Plugin Framework

How To Setup Notifications/Triggers From DAP to 3rd Party APIs

We have now created a plugin framework that will allow DAP to trigger calls to 3rd party services when a user is added to a product (subscription/registration event) or when a user loses access to product (unsubscribe/unregister event).

In fact, we used the same framework to develop DAP -> Mailchimp integration in DAP 4.1.

Here’s the steps :

1) If you want DAP to trigger calls to the APIs/methods you wrote upon an addUserToProduct event or removeUserFromProduct event in DAP, then in the DAP products page – > notify plugin field, use the following format to integrate the APIs/class files.  You can integrate multiple systems with DAP using this framework.

Say you want to integrate classname1 (that has the necessary APIs to register/unregister users to 3rd party service like Mailchimp ) and classname 2 (that has the necessary  APIs to register/unregister users to another 3rd party service like GetResponse), then use this format in the notify plugins field above.

classname1:VALUE 1 you want to pass to the api: VALUE 2 you want to pass to the api: VALUE 3 you want to pass to the api

If you want DAP to call multiple APIs/ Classes, then just create a comma seperated list of classes that DAP should notify.
classname1:VALUE 1 you want to pass to the api: VALUE 2 you want to pass to the api: VALUE 3 you want to pass to the api,
classname2:VALUE 1 you want to pass to the api: VALUE 2 you want to pass to the api,
classname3:VALUE 1 you want to pass to the api

Whatever values (VALUE1, VALUE2.. ) you put next to the class name (all values should be “:” separated), DAP will forward those params/values to your APIs when a user is added to product or user is removed from product.

To integrate say classname1 which consists of the methods/apis to talk to your 3rd party services, create a folder called classname1 under /dap/plugins folder. Then under the classname1 folder, create a php script called classname1.class.php  (just the way you notice a folder called mailchimp and under mailchimp a class file called mailchimp.class.php).

So you will have something like this:

/dap/plugins/classname1/classname1.class.php

Here’s what you need to have in classname1.class.php ( skleton class implementation ) :

< ?php

class classname1 {

function classname1() // constructor
{ }

//======== USER REGISTRATION===========

// this function is called by dap when a user is added to a product

function register($userId, $productId, $params) {

logToFile(“classname1.class.php: register(): “, LOG_INFO_DAP);
$dapuser = Dap_User::loadUserById($userId);
$email = trim($dapuser->getEmail());
$username = trim($dapuser->getUser_name());
$firstname = trim($dapuser->getFirst_name());
$lastname = trim($dapuser->getLast_name());

$data = explode(“:”,$params);

}

function unregister($userId, $productId, $params)
{
logToFile(“classname1.class.php: register(): “, LOG_INFO_DAP);

$dapuser = Dap_User::loadUserById($userId);
$email = trim($dapuser->getEmail());

$data = explode(“:”,$params);

}

}
?>

NOTE:

You MUST have same name methods (called register() and unregister() ) and the exact method signature as you see above.

You can  call other methods/functions from register/unregister and/or

You can call 3rd party APIs from register/unregister methods and/or

You can include other class files.

Whatever values you pass (VALUE1, VALUE2 etc) via notify plugin, you can access those values in these methods. The values are available in the $params array.

That’s it.

You can add a test user to a product in DAP (via dap admin -> add users) and see if things work as expected.

GetResponse Integration

DAP integrates with GetResponse very easily.

How it works

If you are on DAP 4.1, then DAP can connect with getresponse using the APIs provided by getresponse.

So when someone buys or signs up for that Product, then DAP will automatically notify your GetResponse list, and add the buyer or subscriber (if it’s a free sign-up) to your GetResponse list.

1) Retrieve the getresponse API Key from this URL:

http://www.getresponse.com/my_api_key.html

2) Then go to DAP products page, select the product and under the Notify Plugin section, add the following:

Notify Plugin upon User -> Product Activation (Add) =>
getresponse:<your API key>:<compaign_name>

For ex -

getresponse:89kjhjgjfhgf76ikghkgk:MYCOMP

That’s it.

Now go to DAP admin -> add users page and add a brand new user / email and see what happens.

The added user shd first receive the confirmation email from getresponse and upon confirmation, the user shd get added to getresponse .

If it does not work, then set the dap log level to 5, go to dap system logs-> Empty log content, and rerun the test.
Then send us the log snippet from dap system -> logs.

    That’s it.

    Mailchimp Integration

    Subscriber Flow

    The flow of subscriber is “FROM DAP TO Mailchimp“. User signs up at DAP first, then DAP automatically adds the user to Mailchimp list.. Admin removes the user’s access to a product, and DAP automatically removes the user from Mailchimp list. This feature is available starting DAP v4.1.

    How it works

    1. Login to your account at http://admin.mailchimp.com/account/api/ and note down the API Key.

    Image 1:

    2. Go to http://admin.mailchimp.com/lists/ and grab your List’s Unique Id. Click the “settings” link for the list – the Unique Id is at the bottom of that page.

    Image 2:

    3. Log in to your DAP Admin Dashboard -> Products Page and select the product (whose members you wish to add automatically to your Mailchimp list.

    4. If the list Id of the mailchimp list that you want to integrate with a DAP product/membership is say “ffffffffff”, and say your Mailchimp API Key is ‘ffffffffffffffffffffffffffffff-us2′ then add the following to the “Notify Plugin upon User -> Product Activation (Add)” in DAP products page and HIT Save/Update Product.

    mailchimp:ffffffffffffffffffffffffffffff-us2:ffffffffff

    Image 3:

    That’s it!

    Save the product and this completes the DAP->Mailchimp integration.

    How This Works

    So let’s say you picked the list “ffffffffff” in your Mailchimp account, and the DAP Product “Example Subscription Product” (as shown in the screenshots above).

    So once you add “mailchimp:ffffffffffffffffffffffffffffff-us2:ffffffffff” to the product’s “Notify plugin upon user->product activation” and “Notify plugin upon user->product de-activation” field and save it, every time someone gets access to the “Example Subscription Product” product (regardless of whether they buy it, or you give them access on the backend), DAP will  automatically  add them to the list – ffffffffff. And everytime you remove the user’s access to product (click on ‘Remove’ in DAP manage users page), DAP will automatically remove the user from the list.

    df11c84ab4

    How To Use DAP’s Default Password

    Starting DAP 3.8, DAP has a new feature where you can ask DAP to always generate a pre-chosen, default password of your choice for all new members.

    So all new users will be assigned the same default password, which they can of course change as soon as (or any time after) they login.

    This is especially helpful for new users, if instead of DAP, you want a third-party service like Aweber to send out the new member’s “Welcome Email” which contains their email and password.

    Since DAP is unable to pass the randomly generated password to Aweber, instead, you can setup a default password by going to

    Setup > Config > Advanced > “If you want DAP to generate a default password for all new users, enter it here. If not, leave blank”

    So if you set this password to say, “changethis“, then DAP will give out the same password to all new users.

    Then, in the welcome email you configure at, say, Aweber, you would put the Aweber merge code for email id, and then enter this pre-selected password (because you already know what it is) into your Aweber email, like this:

    Hello {!firstname},

    Welcome to Example.com. You may log in to your member’s area at:

    Email: {!email}
    Password: changethis

    Thank you,

    - Admin from Example.com

    And if you ever change the default password in DAP, don’t forget to also change it in your welcome email at Aweber (or 3rd party email service).

    Also, don’t use the default password in any subsequent emails, other than the Welcome email (very first email sent to member through Aweber), because the member may have already changed their password by then.

    WARNING: You must have also set up DAP/Aweber integration first before you attempt to do this.

    Importing Users In Bulk Into DAP

    DAP allows you to import users in bulk from an external system or database.

    Pre-requisites for Importing Users

    1) You must have already created the Product into which the users will be imported 2) The user list has to be in a CSV (comma separated) format (one user per line), with the exact format being:

    Email,FirstName,LastName

    LastName is optional. So your user list could have just

    Email,FirstName

    Example:

    Joe@example.com,Joe,Customer Jill@anothersite.com,Jill Bob@another.com,Bob,Member

    How to do the actual import

    1. Go to Users > Add > “Bulk-Add Multiple Users To A Product”
    2. Paste your CSV list into the large text area
    3. Select the Product into which you want to import the users
    4. Check the “Mark Users as Paid” checkbox if you want them to have “Paid” access to the content (just as if they are actual paying members). If you don’t check it, they will all have access as a “Free” user (instead of a “Paid” user), which means they will only have access to content within the Product that you have marked as “Free”.
    5. Click on the “Bulk Add Users” button. That will first save this entire list as a CSV file in your /dap/bulk folder on your site. And then, the next time the Hourly cron (dap-cron.php) runs, it will add them one by one to the product, and send them emails as per your Product set up. So if your Product has the “Thankyou-Email” subject and body filled out, it will individually send out each of the users that thankyou email.

    DAP will also allow bulk import of users with their existing profile

    This includes their existing password and other profile data as detailed in this video: See Bulk Add Users

    But please make sure you are using at least DAP v4.2.1 and LiveLinks v1.7 , because what’s explained below is only available starting those versions.

    Pre-requisites for Importing Users with their existing Password, Access Start & End Dates

    1) You must have already created the Product into which the users will be imported

    2) The user list has to be in a CSV (comma separated) format (one user per line), with the exact format being:

    Email,Firstname,Lastname,Password,ProductName, Address,City,State,Zip,Country,Phone,Company, Flag (to indicate Paid or Free user), Access Start Date, Access End Date,UserName

    Example:

    joe@somesite.com,Joe,Member,test123,Example One-time Product,99 hill ave,Cityname,NY,10001,USA,,Plug and Play Inc,y,2011-03-16, 2012-03-15,JoeMember

    The only required fields are Email, FirstName and ProductName. If you do not want to supply a value for any of the optional fields, but still wish to import certain others, then just leave those fields empty in the data row (but the commas should remain) as shown below.

    Email,Firstname,,,ProductName,,,,,,,,Flag (to indicate Paid or Free user), Access Start Date, Access End Date,UserName

    How to do the actual Import

    Create a file with the name /dap/bulk/importusers.csv file so it has the users you want to import in the format specified above.

    Run this script on your browser to complete the import. To do that, visit the url…

    http://www.yoursite.com/dap/dap-bulkImport.php

    Note:

    * Replace “yoursite.com” with your actual domain name.

    * And try to limit the number of users you are importing with this method to not more than 100 users at a time. Otherwise the import may timeout, because the import occurs real time (not via cron). If the user already exists in dap, then the script will just skip that user and move on to the next user in the bulk add list.

    Troubleshooting Email Delivery

    The Basics Of Sending Email Through Your Web Site

    DAP is not an email service (like, say, Aweber).

    DAP is just a script – a tool, like Microsoft Outlook or Thunderbird – that simply sends out email using your web host’s email server.

    It is your web host’s mail server that actually sends out the email to the recipient. So once DAP sends out the email, it has no control over what happens next.

    It’s just like when you put your (regular mail) letter in the mailbox (post box). It is then up to the Postal Service to actually pick up your letter, and deliver to the destination address.

    So if the emails that DAP sends out don’t get delivered to your recipients, there could be more than one reason for that.

    Welcome Emails Not Going Out

    See this post: Troubleshooting Welcome-Email Delivery

    Autoresponder Emails Not Going Out

    If yours is a new site setup, then this is usually because the hourly cron-job has not been setup.

    However, if the emails were going out fine previously, and suddenly stopped going out, then it usually is because…

    • Something changed on your host that caused the cron to stop working.
    • There is an error in the job queue, because of which DAP is unable to proceed with the remaining non-error emails. This could have happened if you tried to send out a broadcast to a CSV list, and there was an error in one of the emails from the CSV list.
    • You’re trying to use a third party “SMTP” server to send out the emails, and your server is unable to connect to that server because the authentication settings you’ve configured on “Email > SMTP” are incorrect.

    Steps to troubleshoot

    1. Make sure that the hourly cron (dap-cron.php) is still running – you need to look at your web hosting control panel for that.
    2. Go to “System > Job Queue” and scroll through any items there, and see if there are any scheduled messages there with the status “Error”. If yes, then click on the “Delete Jobs In Error” link. That will delete any jobs that can’t be processed because of an error in the email id or in the import process. Also be sure to click on “Delete Successful Jobs (till yesterday)” just to clear up old, sent emails.
    3. Also go to “System > Logs” and empty the logs.
    4. Go to “System > Config” and set “DAP Log Level” to “5″. That will start logging all the details you/we may need for troubleshooting.
    5. Wait for the top of the next hour and then re-visit the queue and see if emails are going out.
    6. If they still aren’t going out, go back to “System > Logs”, copy paste all text there, and open a new ticket with that info, of course, also giving us more details about the problem, what you have tried, etc, along with your login info for: FTP, WP Admin, DAP Admin, and Web Host Control Panel.

    Server Blacklisting

    If your inexpensive (read as cheap :-) shared web host is hosting a large number of sites on one server, and one of them knowingly sends out spam (or mistakenly gets flagged for spam), that will put the email deliverability of every web site on that server in jeopardy, because your site now shares the same IP address as that of an “alleged” spammer.

    So your emails get sent to junk/spam folder by Gmail and Yahoo. Or worse, they just totally disappear into the ether.

    Hourly Email-Sending Limits

    Almost all shared hosts have hourly email sending limits. For example, DreamHost has an outgoing limit of 300 emails per hour. Which means, a total of only 300 emails can be sent out per hour through any web site hosted on DreamHost. All of the following count towards the 300 limit:

    • Emails sent by any scripts on your site – like DAP
    • Your WordPress blog notification emails
    • Your WordPress admin emails,
    • WP forgot password emails,
    • WP comment notification emails,
    • Forum notification emails,
    • Forum emails sent to each other by your users,
    • Forum-software Admin notification emails,
    • Support software user and admin notification emails
    • Tell-a-friend emails
    • Viral-inviter type emails
    • Emails sent through Outlook or Thunderbird where you have set the outgoing SMTP server to be your web site’s SMTP server
    • Emails sent by others using the same SMTP server to send out emails-  like your business partners, employees, etc
    • DAP User welcome emails, Payment notification emails, Forgot password emails, Autoresponder emails, Broadcast emails, etc

    So do you see how quickly you can go over that hourly limit of 300 emails per hour?

    But here comes the worst part…

    Once you go over that limit, any emails that are actually sent by you or the scripts running on your site, will not actually result in any kind of error. The mail server will respond by saying that the email(s) has been sent successfully, but in reality, on the backend, it quietly “snuffs out” the email. Which means, it doesn’t go anywhere – just gets sent to a “blackhole”. So you keep thinking that you sent out the email. DAP keeps thinking it has sent out the email. But in reality, the emails never actually get sent.

    This is the same as you actually putting your letter into the mailbox at the Post Office. But then, imagine this: The postal worker who comes to pick up your mail, quietly goes to the back of the post office and dumps it all into one giant trash can, and destroys all of the mail. So you’re thinking you actually mailed out that important check to pay your utility bill. But the utility company never gets your check, and they slam you with a late fee.

    Possible Solutions

    1) DAP + Aweber (most expensive, most reliable)

    2) DAP + 3rd party SMTP service provider (AuthSMTP.com or SMTP.com) (less expensive than Aweber, slightly less reliable too)

    3) DAP + Good web host (cheapest option, but can have mixed results – all depends on your host).

    You could always use DAP and external SMTP service provider like AuthSMTP.com or SMTP.com to send out bulk mail through DAP while totally bypassing your web host’s email system. This is probably the next best thing to using a service like Aweber.

    And if you can’t afford even that, then simply use DAP on a good web host. We ourselves use just DAP and Dreamhost‘s email servers to send out emails to all of our users.

    And DAP also has built-in job queues to schedule outgoing emails while also making sure that you don’t exceed your web host’s hourly email sending limits (dreamhost’s limit is 300 emails/hour, I think). We use multiple SMTP servers from our own other web sites, all combined to be able to send a few thousand emails per hour.

    But even with a lot of planning, it is easy to go over the hourly limit.

    So the next time you see in your Job Queue that emails were sent out successfully, but the recipient never received it, here are some things to check:

    1) It landed in your recipient’s junk/spam folder. Ask them to whitelist or add your email address to their contacts list.

    2) You have overshot the limit, so you would have to actually send out the email again.

    3) Try to send out broadcasts during a low-traffic time – say like later in the night – when you’re not actively sending out emails, and using up precious email counts from that hourly quota.

    DAP vs Aweber

    (Or… “DAP vs MailChimp”, “DAP vs. GetResponse”, …. “DAP vs 3rd-Party-List-Service”)

    We often get asked why use Aweber (or other third-party list service) when DAP itself is an autoresponder. So here’s a brief overview of when and why it makes sense to use DAP or Aweber.

    Why Aweber

    DAP is not an email service like Aweber.

    DAP is just a tool – like Outlook or Thunderbird – that simply sends out email using your web host’s email server.

    If your inexpensive shared web host is hosting a large number of sites on one server, and one of them sends out spam (or mistakenly gets flagged for spam), that will put the email deliverability of every web site on that server, in jeopardy, because your site now shares the same IP address as that of an “alleged” spammer.

    So your emails get sent to junk/spam folder by Gmail and Yahoo. Or worse, they just totally disappear into the ether. Your customers never get your email. Your campaign suffers. Your conversion plunges. This won’t happen with Aweber.

    Aweber (and other premier email service providers) have staff on hand just for this purpose. Their core business is about email deliverability. They spend a lot of time, money and resources dealing with regular ISP’s (like AOL and SBC) to make sure their lists – and their reputation – remain clean. Which is also probably why they shut down large lists without much of a warning to you, and do other similar crazy stuff.

    I guess it works for them – and the other Aweber users, because when you send out an email through your Aweber list, it almost always gets there in your recipient’s inbox. Which is very cool. And which is why they also charge so much for their service.

    But if you can’t afford their high fees, then you can of course use DAP’s built-in email autoresponder, whose deliverability is only as good as your host’s spam reputation :-) Of course, you can always use DAP and external SMTP service provider like Fusemail.com or AuthSMTP.com (which we use ourselves) to send out bulk mail through DAP while totally bypassing your web host’s email system. This is probably the next best thing to using a service like Aweber.

    And if you can’t afford even that, then simply use DAP on a decent web host. We ourselves use just DAP and AuthSMTP.com to send out emails to all of our users. DAP also has built-in job queues to schedule outgoing emails while also making sure that you don’t exceed your web host’s hourly email sending limits (most web hosts limit you to 300 outgoing emails/hour). We also use multiple SMTP servers from our own other lesser-used web sites, all combined to be able to send thousands of emails an hour.

    When it comes to features, here’s what DAP does *not* have that more expensive services like Aweber and GetResponse provide.

    Advantage: DAP

    • Unlimited Autoresponders
    • Unlimited emails for free (no limit on how large your list can grow – so practically free, since you’ve already paid for DAP)
    • No additional cost for this service – part of DAP
    • Add same email to multiple Autoresponders (DAP special)
    • Email throttling so as to not exceed your web host’s hourly email sending limits
    • Ability to merge member data – like password – into emails (DAP only – you can’t do this if you use a 3rd party list service)

    Advantage: Aweber and the others

    • Ability to track open rates
    • Ability to track click-through rates (coming in a future version)
    • Ability to automatically send out your newly published blog posts as a broadcast (coming in a future version)
    • DAP has no “Pretty Form” generators like Aweber & Getresponse (coming in a future version)

    So given a choice, here are your options in the exact order listed below:

    1) DAP + Aweber: Match made in heaven

    2) DAP + 3rd Party List Services: 2nd best option

    3) DAP + Your Web Host: Very usable and workable option as long as you are hosting with a decent web host.

    Feel free to comment below if you have any questions.