liliom/laravel-zoho-campaigns

一个用于集成 Zoho Campaigns v1.0 API 的库。构建和管理营销活动和联系人列表。

v1.0.3 2019-05-01 17:52 UTC

This package is auto-updated.

Last update: 2024-08-26 11:41:03 UTC


README

Laravel Zoho Campaigns 1.0

Laravel 包,帮助您使用 Zoho Campaigns API v1.0 创建、发送和跟踪邮件营销活动,以帮助您建立强大的客户基础。从精美的电子邮件模板到易于使用的编辑器,再到自动化工具和实时分析,Zoho Campaigns 一应俱全。

Total Downloads Latest Stable Version License

安装

首先,通过 Composer 安装此包。

$ composer require liliom/laravel-zoho-campaigns

Laravel 5.5 及以上版本

您不需要做任何事情,此包使用包自动发现功能,一旦通过 Composer 安装即可使用。

Laravel 5.4 及以下版本

然后在 config/app.php 文件中包含服务提供者。

'providers' => [
    ...
    Liliom\Zoho\Campaigns\CampaignsServiceProvider::class,
    ...
];

并添加别名

'aliases' => [
    ...
    'Campaigns' => Liliom\Zoho\Campaigns\CampaignsFacade::class,
    ...
],

配置

点击您的 Zoho 营销活动 设置 页面以生成新的 API 密钥。要加载它,请将其添加到您的 config/services.php 文件中

'zoho' => [
    'campaigns' => [
        'auth_token' => env('ZOHO_CAMPAIGNS_AUTH_TOKEN', ''),
    ],
]

然后添加 Zoho 营销活动 API 认证令牌到您的 .env 文件

ZOHO_CAMPAIGNS_AUTH_TOKEN={YOUR_AUTH_TOKEN}

使用

1. 列表管理

获取邮件列表。 \Campaigns::getMailingLists();

    /**
     * @param string   $sort      [asc/desc]
     * @param int|null $fromIndex values are in number.
     * @param int|null $range     values are in number.
     *
     * @return object
     */
    public function getMailingLists(
        string $sort = 'desc',
        int $fromIndex = null,
        int $range = null
    ): object;

高级详情包括所有数据,如订阅者详情、统计数据以及发送到该邮件列表的所有活动的完整详情。使用此 API,您可以获取列表的高级详情。 \Campaigns::getListAdvancedDetails();

    /**
     * @param string   $listKey    List Key to send a subscription mail to contacts.
     * @param string   $filterType sentcampaigns,scheduledcampaigns,recentcampaigns.
     * @param int|null $fromIndex  values are in number.
     * @param int|null $range      values are in number.
     *
     * @return object
     */
    public function getListAdvancedDetails(
        string $listKey,
        string $filterType = 'sentcampaigns',
        int $fromIndex = null,
        int $range = null
    ): object;

获取邮件列表。 \Campaigns::getListSubscribers();

    /**
     * @param string   $listKey   List Key to send a subscription mail to contacts.
     * @param string   $status    [active/recent/most recent/unsub/bounce].
     * @param string   $sort      [asc/desc]
     * @param int|null $fromIndex values are in number.
     * @param int|null $range     values are in number.
     *
     * @return object
     */
    public function getListSubscribers(
        string $listKey,
        string $status = 'active',
        string $sort = 'desc',
        int $fromIndex = null,
        int $range = null
    ): object;

获取订阅者字段以获取订阅者的个人资料信息。使用此 API,您可以获取所有订阅者字段列表。 \Campaigns::getAllSubscriberFields();

    /**
     * @param string $type xml (or) json
     *
     * @return array
     */
    public function getAllSubscriberFields(
        string $type
    ): array;

使用我们的 API 获取分段详情。 \Campaigns::getSegmentDetails();

    /**
     * @param string $listKey List Key to send a subscription mail to contacts.
     * @param int    $cvId    You will get cvid from @method getMailingLists().
     *
     * @return object
     */
    public function getSegmentDetails(
        string $listKey,
        int $cvId
    ): object;

使用此 API,您可以获取分段订阅者及其相关详情,如姓名、添加时间、公司和他们电话号码。 \Campaigns::getSegmentContacts();

    /**
     * @param int $cvId You will get cvid from @method getMailingLists().
     *
     * @return object
     */
    public function getSegmentContacts(
        int $cvId
    ): object;

更新列表可以是重命名列表或将注册表单与列表关联。使用此 API,您可以在邮件列表中进行更改。 \Campaigns::updateListDetails();

    /**
     * @param string $listKey     List Key to send a subscription mail to contacts.
     * @param string $newListName Give list name.
     * @param string $signUpForm  [public/private]
     *
     * @return object
     */
    public function updateListDetails(
        string $listKey,
        string $newListName,
        string $signUpForm = 'public'
    ): object;

使用此 API,您可以删除邮件列表。您只需提供列表密钥,并选择是否从组织或仅从列表中删除所有列表订阅者。 \Campaigns::deleteMailingList();

    /**
     * @param string $listKey        List Key to send a subscription mail to subscribers.
     * @param string $deleteContacts [on/off]
     *
     * @return object
     */
    public function deleteMailingList(
        string $listKey,
        string $deleteContacts = 'off'
    ): object;

您无需研究列表的有效性或特定列表的覆盖范围。使用我们的 API 认证令牌,您可以找出列表中订阅者的数量。 \Campaigns::listSubscribersCount();

    /**
     * @param string $listKey List Key to send a subscription mail to subscribers
     * @param string $status  [active|unsub|bounce|spam]
     *
     * @return object
     */
    public function listSubscribersCount(
        string $listKey,
        string $status = 'active'
    ): object;

用户可以不使用注册表单或通过其他用户添加来订阅列表。他们可以使用此 API 订阅,添加的用户将收到通知。请记住,使用此 API,您只能更新私有列表中现有潜在客户的订阅者详情。 \Campaigns::listSubscribe();

    /**
     * @param string $listKey     List Key to send a subscription mail to subscribers
     * @param string $contactInfo Provide email id to be moved to Do-Not-Mail registry.
     * @param null   $sources     Subscriber source can be added.
     *
     * @return object
     */
    public function listSubscribe(
        string $listKey,
        string $contactInfo,
        $sources = null
    ): object;

您的列表中有不感兴趣的潜在客户?没关系,您只需取消他们的订阅即可。使用此 API,您可以取消潜在客户的订阅,并将通知他们。 \Campaigns::listUnsubscribe();

    /**
     * @param string $listKey     List Key to send a subscription mail to subscribers
     * @param string $contactInfo Provide email id to be moved to Do-Not-Mail registry.
     *
     * @return object
     */
    public function listUnsubscribe(
        string $listKey,
        string $contactInfo
    ): object;

如果您不希望向该用户发送电子邮件或他们从组织中取消订阅,您可以将联系人移动到“不发送邮件”注册表。使用此 API,您可以将联系人移动/添加到“不发送邮件”注册表。 \Campaigns::contactDoNotMail();

    /**
     * @param string $contactInfo Provide email id to be moved to Do-Not-Mail registry.
     *
     * @return object
     */
    public function contactDoNotMail(
        string $contactInfo
    ): object;

您知道您可以使用 API 不仅可以将潜在客户添加到新列表,还可以添加到现有列表吗?嗯,使用此 API,您可以将潜在客户添加到现有列表。 \Campaigns::addListSubscribersInBulk();

    /**
     * @param string $listKey  List Key to send a subscription mail to subscribers
     * @param string $emailIds Provide maximum of ten (10) EMAILID's comma (,) separately.
     *
     * @return object
     */
    public function addListSubscribersInBulk(
        string $listKey,
        string $emailIds
    ): object;

使用此API,您可以在列表中添加新的列表和订阅者,而无需在产品UI中手动操作。\Campaigns::addListAndContacts();

    /**
     * @param string $emailIds        Provide maximum of ten (10) EMAILID's comma (,) separately.
     * @param string $listName        Provide your list name.
     * @param string $signUpForm      [public/private]
     * @param string $mode            'newlist'
     * @param string $listDescription Provide a description for your list.
     *
     * @return object
     */
    public function addListAndContacts(
        string $emailIds,
        string $listName,
        string $signUpForm = 'public',
        string $mode = 'newlist',
        string $listDescription = ''
    ): object;

自定义字段可用于存储任何类型的信息,设置字符限制,并用于保存特定数据。使用此API,您可以创建自定义字段以存储有关订阅者的独特信息。\Campaigns::addCustomField();

    /**
     * @param string $fieldName   Alphanumeric
     * @param string $fieldType   [Text|Integer|Phone|Date|Picklist|Email|Checkbox|LongInteger|URL|textarea|RadioOption|Multiselect|DateTime|Decimal|Percent]
     * @param int    $fieldLength This lets you to set length of the field. Default value is 20.
     * @param string $type        xml (or) json
     *
     * @return object
     */
    public function addCustomField(
        string $fieldName,
        string $fieldType,
        int $fieldLength = 20,
        string $type = 'json'
    ): object;

通过称呼订阅者的名字、姓氏或其他适当的内容来发送您的活动。使用此API,您可以创建合并标签。\Campaigns::createMergeTag();

    /**
    * @param string $tagType     Custom
    * @param string $fieldName   Alphanumeric
    * @param string $fieldType   [Text|Integer|Phone|Date|Picklist|Email|Checkbox|LongInteger|URL|textarea|RadioOption|Multiselect|DateTime|Decimal|Percent]
    * @param string $mailValue   Give a default value for the tag to be used in email content.
    * @param string $socialValue Give a default value for the tag to be used in email content of social campaigns.
    * @param string $type        xml (or) json
    *
    * @return object
    */
    public function createMergeTag(
        string $tagType,
        string $fieldName,
        string $fieldType,
        string $mailValue = '',
        string $socialValue = '',
        string $type = 'json'
    ): object;

您可以通过在方法前添加async()函数来异步调用Zoho Campaigns API。

\Campaigns::async(true) // async calls on, default value is true
\Campaigns::async(false) // async calls off


// Later you can append the callback() to be executed when the response returns.
\Campaigns::async()->callback(Callable $requestCallback) 

有关代码错误含义,请参阅错误代码

有关更多参数细节,请参阅API文档,或阅读源代码

2. 活动管理

这还是一个正在进行中的项目,遗憾的是目前尚未实现,请耐心等待🙈

3. 额外方法

// To test credentials and make sure the Auth Token is configured correctly. 
\Campaigns::testCredentials();

贡献

请参阅贡献指南

变更日志

请参阅变更日志以获取有关最近更改的更多信息。