thiio/active-campaign-php-sdk

这是一个基于PHP构建的SDK,用于消费Active Campaing的v3 API,具体详情请参考https://www.activecampaign.com/

0.0.2 2023-11-29 20:32 UTC

This package is not auto-updated.

Last update: 2024-09-19 16:08:20 UTC


README

消费ActiveCampaign的v3 API的实现

注意

这是本库的beta版本,主要目标是消费ActiveCampaign的V3 API。

所需条件

需要一个ActiveCampaign账户。您可以在https://www.activecampaign.com/注册

安装


实现模型

  • 联系人
  • 标签
  • 列表
  • 分组列表
  • 连接
  • 电子商务客户
  • 电子商务订单

使用此库的示例

//YOUR ACTIVE CAMPAIGN CREDENTIALS
$url = "<https://YOUR_USER.api-us1.com>";
$key = "<YOUR_TOKEN_KEY>";

//Initialize a new instance of active campaign library class
$client = new ActiveCampaign();
$client->initialize($url, $key);

/* 
Instanciate a contact model and add values to the attributes specified on:

https://developers.activecampaign.com/reference#contact 

*/
$contact = new ActiveCampaignContact();
$contact->setEmail("jhon_doe@gmail.com");
$contact->setFirstName("Jhon");
$contact->setLastName("Doe");
$contact->setPhone("+529985656464");

//Fetch contacts class and perform the create request
$contacts = $client->contacts();

try{
    //Perform create request sending the contact model
     $response = $contacts->create($contact);
    
    //If response success var_dump all content
    if($response->success){
    
        echo "Contact successfully created \n";
        var_dump($response->body->contact);
        
    }else{
        //If any error or message is present print it out
        if(isset($response->body->message)){
            echo $message;
        }
        if(isset($response->body->errors)){
            foreach($response->body->errors as $error){
                echo $error->title."\n";
                echo $error->detail."\n";
                echo $error->code."\n";
            }
        }
        
    }
}catch(Exception $e){
    echo $e->getMessage();
}

更多示例请参阅项目内的examples文件夹

此存储库是从https://github.com/DevelopFer/active-campaign-v3-api-php分叉的