silici0/rdstation

RDStation API 2.0 的 Laravel 包装器

安装数: 3,664

依赖者: 0

建议者: 0

安全: 0

星标: 4

关注者: 3

分支: 2

开放问题: 0

类型:laravel-package

dev-master 2021-06-18 19:05 UTC

This package is auto-updated.

Last update: 2024-09-19 02:23:53 UTC


README

此库提供对 RDStation API v2 的面向对象包装的 PHP 类访问

安装

composer require silici0/rdstation:dev-master

发布配置文件

php artisan vendor:publish --provider="silici0\RDStation\RDStationServiceProvider"

迁移

需要安装 rdstation 数据库来存储 "代码" 和 auth "密钥"

php artisan migrate

配置

访问 https://appstore.rdstation.com/pt-BR/publisher 创建新的应用程序,在新的应用程序中使用回调 URL yourdomain.com/rdstation,获取 ClientID 和 ClientSecret 密钥,将这些放在 config/rdstation.php 中

现在您可以通过访问 yourdomain.com/rdstation 使用它,只需访问链接,授予它权限,返回时应看到一个成功消息。

现在可以使用了。

使用示例

$rdstation = resolve('rdstation');

//Create or Update Lead
$d = array();
$d['name'] = 'Fulano de tal';
$d['email']= 'rafael@teste.com.br'; //Lead email Key
$d['personal_phone']='(11) 4022-1234';

$rdstation->createOrUpdate($d);

// Create new event for the Lead

$calltracking = Cookie::get('_rdtrk');
if (!empty($calltracking)) 
    $d['client_tracking_id']= $calltracking;
$utm_source = Cookie::get('__trf.src');
if (!empty($utm_source)) 
    $d['traffic_source'] = $utm_source;
else {
	// GET UTM and save in $d array
}

$rdstation->saveEvent('CONVERSION TAG NAME', $d);

// Update Funnel 
$d = array();
$d['email'] = 'rafael@teste.com.br'; //Lead email Key
$d['lifecycle_stage	'] = 'Lead';
$d['opportunity'] = false;
$d['contact_owner_email'] = 'rafael@user.com'; // Must be a rdstation user

$rdstation->updateFunnel($data);

自定义字段

要发送自定义字段,您需要使用 api_identifier 字段,使用 getFields() 方法检查字段的 api_identifier

$rdstation->getFields();