Skip to content

Instantly share code, notes, and snippets.

@willjohnson
Created June 6, 2016 18:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willjohnson/b62396c035be0ecbbd51dc74f73f64f8 to your computer and use it in GitHub Desktop.
Save willjohnson/b62396c035be0ecbbd51dc74f73f64f8 to your computer and use it in GitHub Desktop.
Easy way to pass data from PHP application to Drip

Using the Drip API Wrapper for PHP (https://github.com/DripEmail/drip-php) is super easy. Here is an example.

You can get your Drip (http://www.getdrip.com) API token by logging into Drip and going to your User Settings.

Set up a workflow in Drip so that when the tag "new_user" is applied it starts the onboarding email course that you created.

<?php
$drip_api_token = 'from_drip_user_settings'; // it would be a better idea to store this as an environmental variable
//
// Add user to onboarding email workflow
//
require_once ("includes/drip_api/Drip_API.class.php");
$Drip = new Drip_API($drip_api_token);
$subscriber = CreateSubscriber($user_id, $email);
$Drip->create_or_update_subscriber($subscriber);
function CreateSubscriber($user_id, $user_email){
$subscriber = array();
$subscriber["account_id"] = "1234567"; // Drip account ID which you can find in the javascript under Settings/Site Setup
$subscriber["email"] = $user_email;
$subscriber["user_id"] = $user_id;
$subscriber["tags"] = array("customer", "new_user");
return $subscriber;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment