The only required configuration is the Push API key. You can get your Push API key via the Push API settings in your Userlist account.
Configuration values can be set when creating a new push client or via environment variables. The environment takes precedence over values provided during the initialization process.
Before tracking user or event data, create a new push client. If you configured your push key via environment variables there’s nothing to add. Otherwise, see the example above.
1
$userlist=new\Userlist\Push();
Tracking Users
Creating & updating Users
1
2
3
4
5
6
7
8
9
10
11
12
13
$user=['identifier'=>'user-1','email'=>'user@example.com','properties'=>['first_name'=>'Jane','last_name'=>'Doe']];$userlist->users->push($user);$userlist->user($user);// Alias$userlist->users->create($user);// Alias
$company=['identifier'=>'company-1','name'=>'Example, Inc.','properties'=>['industry'=>'Software Testing']];$userlist->companies->push($company);$userlist->company($company);// Alias$userlist->companies->create($company);// Alias
$relationship=['user'=>'user-1','company'=>'company-1','properties'=>['role'=>'admin']];$userlist->relationships->push($relationship);$userlist->relationship($relationship);// Alias$userlist->relationships->create($relationship);// Alias
This is equivalent to specifying the relationship on the user model.
$event=['name'=>'project_created','user'=>'user-1','properties'=>['name'=>'Example Project',]];$userlist->events->push($event);$userlist->event($event);// Alias$userlist->events->create($event);// Alias
Sending Transactional Messages
1
2
3
4
5
6
7
8
9
10
11
12
13
$message=['user'=>'user-1','template'=>'welcome-email','properties'=>['account_name'=>'Example, Inc.','billing_plan'=>'Pro',]];$userlist->messages->push($message);$userlist->message($message);// Alias$userlist->messages->create($message);// Alias
Book your discovery demo
Let’s see how Userlist fits into the bigger picture of your SaaS business. You’ll learn about our automation features, integrations, proven lifecycle frameworks, and how we can help you hit your SaaS growth targets.