collinped/aimtell-php

Aimtell 的 PHP SDK

1.0.9 2021-01-04 19:35 UTC

This package is auto-updated.

Last update: 2024-09-05 03:49:46 UTC


README

Latest Version on Packagist GitHub Tests Action Status Total Downloads

Aimtell 为获得许可的用户提供推送通知服务。此包允许与 Aimtell 的后端 API 接口,以管理您的账户。

Aimtell REST API 文档

安装

您可以通过 composer 安装此包

composer require collinped/aimtell-php

用法

快速示例

$aimtell = new Collinped\Aimtell($apiKey, $defaultSiteId, $whiteLabelId);

$site = $aimtell->site()
                ->create([
                    'name' => 'Sample Website',
                    'url' => 'collinped.com'
                ]);

$campaigns = $aimtell->site($siteId)
                     ->campaign()
                     ->all();

$campaign = $aimtell->site($siteId)
                    ->campaign()
                    ->find($campaignId);

身份验证

  • 获取 API 密钥
  • 设置 API 密钥
  • 获取默认站点 ID
  • 设置默认站点 ID
  • 获取白标 ID
  • 设置白标 ID

站点

  • 获取所有网站
  • 获取网站
  • 获取网站代码
  • 添加网站
  • 更新网站详细信息
  • 获取网站设置
  • 更新网站设置
  • 更新网站包(Safari)
  • 删除网站
  • 获取网站密钥
  • 更新网站密钥

订阅者

  • 获取所有订阅者
  • 获取订阅者
  • 跟踪订阅者属性
  • 跟踪订阅者事件
  • 退出订阅者

  • 获取所有段
  • 获取段
  • 创建段
  • 更新段
  • 删除段
  • 按日获取段计数

欢迎通知活动

  • 获取欢迎通知
  • 获取欢迎通知活动结果(按日)
  • 更新欢迎通知(更新)

手动活动

  • 获取所有手动活动
  • 获取手动活动
  • 获取手动活动点击
  • 获取手动活动结果(按日)
  • 创建手动活动
  • 更新手动活动
  • 删除手动活动

触发活动

  • 获取所有事件触发活动
  • 获取事件触发活动
  • 获取事件触发活动结果(按日)
  • 创建事件触发活动
  • 更新事件触发活动
  • 删除事件触发活动

RSS 活动

  • 获取所有 RSS 活动
  • 获取 RSS 活动
  • 创建 RSS 活动
  • 更新 RSS 活动
  • 删除 RSS 活动

API 活动

  • 获取所有 API 活动
  • 获取 API 活动
  • 获取事件 API 活动结果(按日)

发送推送通知

  • 发送推送通知

身份验证

获取 API 密钥

$aimtell = $aimtell->getApiKey();

设置 API 密钥

$aimtell = $aimtell->setApiKey($apiKey);

获取默认站点 ID

$aimtell = $aimtell->getDefaultSiteId();

设置默认站点 ID

$aimtell = $aimtell->setDefaultSiteId($defaultSiteId);

获取白标 ID

$aimtell = $aimtell->getWhiteLabelId();

设置白标 ID

$aimtell = $aimtell->setWhiteLabelId($whiteLabelId);

站点

获取所有网站 - Aimtell 文档

$websites = $aimtell->site()
                    ->all();

获取网站 - Aimtell 文档

$website = $aimtell->site()
                   ->find($siteId);

获取网站代码 - Aimtell 文档

$website = $aimtell->site($siteId)
                   ->getCode();

添加网站 - Aimtell 文档

$websites = $aimtell->site()
                    ->create([
                        'name' => 'Website Name', // Required
                        'url' => 'facebook.com' // Required
                    ]);

更新网站详细信息 - Aimtell 文档

$websites = $aimtell->site($siteId)
                    ->update([
                        'name' => 'Website Name',
                        'url' => 'facebook.com'
                        'icon' => 'imageUrl.jpg'
                    ]);

获取网站设置 - Aimtell 文档

$websites = $aimtell->site($siteId)
                    ->getSettings();

更新网站设置 - Aimtell 文档

$websites = $aimtell->site($siteId)
                    ->updateSettings([
                        ...
                    ]);

更新网站包(Safari) - Aimtell 文档

$websites = $aimtell->site($siteId)
                    ->updatePackage();

删除网站 - Aimtell 文档

$websites = $aimtell->site($siteId)
                    ->delete();

获取网站密钥 - Aimtell 文档

$websites = $aimtell->site($siteId)
                    ->getKeys();

更新网站密钥 - Aimtell 文档

$websites = $aimtell->site($siteId)
                    ->upsertKeys([
                        ...
                    ]);

订阅者

获取所有订阅者 - Aimtell 文档

$subscribers = $aimtell->site($siteId)
                       ->subscriber()
                       ->all();

获取订阅者 - Aimtell 文档

$subscriber = $aimtell->site($siteId)
                      ->subscriber()
                      ->find($subscriberId);

跟踪订阅者属性 - Aimtell 文档

$subscriber = $aimtell->site($siteId)
                      ->subscriber($subscriberId)
                      ->trackEvent([
                          'first_name' => 'jeff'
                          'gender' => 'male'
                      ]);

跟踪订阅者事件 - Aimtell 文档

$subscriber = $aimtell->site($siteId)
                      ->subscriber($subscriberId)
                      ->trackEvent([
                          'category' => '' // Required
                          'action' => '', // Required
                          'label' => '',
                          'value' => 1.00
                      ]);

退订订阅者 - Aimtell 文档

$subscriber = $aimtell->site($siteId)
                      ->subscriber($subscriberId)
                      ->optOut();

获取所有分段 - Aimtell 文档

$segments = $aimtell->site($siteId)
                       ->segment()
                       ->all();

获取分段 - Aimtell 文档

$segment = $aimtell->site($siteId)
                       ->segment()
                       ->find($segmentId);

创建分段 - Aimtell 文档

$segment = $aimtell->site($siteId)
                       ->segment()
                       ->create([
                           'name' => 'Segment Name'
                           'definition' => 'city==Irvine' // See Aimtell Docs
                       ]);

更新分段 - Aimtell 文档

$segment = $aimtell->site($siteId)
                       ->segment($segmentId)
                       ->update([
                           'name' => 'Segment Name'
                           'definition' => 'city==Irvine' // See Aimtell Docs
                       ]);

删除分段 - Aimtell 文档

$segment = $aimtell->site($siteId)
                       ->segment($segmentId)
                       ->delete();

按时间获取分段计数(按日) - Aimtell 文档

$results = $aimtell->site($siteId)
                   ->segment($segmentId)
                   ->getResultsByDate([
                       'startDate' => '1/1/2020',
                       'endDate' => '1/30/2020'
                    ]);

欢迎通知

获取欢迎通知 - Aimtell 文档

$welcomeNotification = $aimtell->site($siteId)
                               ->welcomeNotification()
                               ->get();

获取欢迎通知结果(按日) - Aimtell 文档

$results = $aimtell->site($siteId)
                   ->welcomeNotification()
                   ->getResultsByDate([
                       'startDate' => '1/1/2020',
                       'endDate' => '1/30/2020'
                    ]);

更新欢迎通知(更新) - Aimtell 文档

$welcomeNotification = $aimtell->site($siteId)
                               ->welcomeNotification()
                               ->update([
                                   'title' => 'Welcome Title', // Required
                                   'body' => 'Welcome body', // Required
                                   'link' => 'http://facebook.com', // Required
                                   'status' => '1' // Required - 0 = Draft, 1 = Active
                               ]);

手动活动

获取所有手动活动 - Aimtell 文档

$campaigns = $aimtell->site($siteId)
                     ->campaign()
                     ->all();

获取手动活动 - Aimtell 文档

$campaign = $aimtell->site($siteId)
                    ->campaign()
                    ->find($campaignId);

获取手动活动点击 - Aimtell 文档

$campaign = $aimtell->site($siteId)
                    ->campaign($campaignId)
                    ->getClicks();

获取手动活动结果(按日) - Aimtell 文档

$campaign = $aimtell->site($siteId)
                    ->campaign($campaignId)
                    ->getResultsByDate([
                        'startDate' => '01/01/2020',
                        'endDate' => '02/15/2020',
                    ]);

创建手动活动 - Aimtell 文档

$campaign = $aimtell->site($siteId)
                    ->campaign($campaignId)
                    ->create([
                        'name' => 'Campaign Name', // Required
                        'title' => 'Campaign Title',
                        ...
                    ]);

更新手动活动 - Aimtell 文档

$campaign = $aimtell->site($siteId)
                    ->campaign($campaignId)
                    ->update([
                        'name' => 'New Campaign Name',
                        'title' => 'New Campaign Title',
                        ...
                    ]);

删除手动活动 - Aimtell 文档

$campaign = $aimtell->site($siteId)
                    ->campaign($campaignId)
                    ->delete();

发送推送通知

发送推送通知 - Aimtell 文档

$notification = $aimtell->site($siteId)
                        ->push()
                        ->title('Sample Notification')
                        ->message('Here is your sample message')
                        ->link('https://www.laravel.com')
                        ->toSubscriber($subscriberId)
                        ->withButton([
                            'link' => 'sampleUrl',
                            'title' => 'Sample Title 1',
                        ])
                        ->withButton([
                            'link' => 'sampleUrl2',
                            'title' => 'Sample Title 2',
                        ])
                        ->send();

测试

composer test

待办事项

  • 手动活动的 A/B 测试
  • 创建手动活动(批量)
  • 更新手动活动(批量)
  • 删除手动活动(批量)
  • 创建事件触发活动(批量)
  • 更新事件触发活动(批量)
  • 删除事件触发活动(批量)
  • 获取通知日志
  • 获取属性日志
  • 获取页面浏览日志
  • 获取事件日志

更新日志

请参阅 更新日志 了解最近的变化。

贡献

请参阅 贡献指南 了解详细信息。

安全漏洞

请审查我们的安全策略,了解如何报告安全漏洞。

鸣谢

许可证

MIT许可证(MIT)。请参阅许可证文件获取更多信息。