2015-08-27 17 views
-1

我正在使用Infusionsoft API諾瓦克SDKInfusionsoft:使用自定義字段檢索聯繫人(諾瓦克SDK)

我的PHP網站有一個username會話值,它與聯繫人的自定義字段(也稱爲username)內的唯一值匹配。我想使用網站的會話值查詢Infusionsoft API,並讓它返回唯一的聯繫人記錄。獲得聯繫人記錄後,我需要確定聯繫人的ID。我該怎麼做呢?

我決定重命名並重新使用「名字」字段(將其更改爲「用戶名」)而不是使用自定義字段。

做這樣的說法我有一些代碼工作:

<?php 

// Include the SDK 
require_once('Infusionsoft/infusionsoft.php'); 

//Get username value from session 
$UserName = $_SESSION["Username"]; 

//Query contacts table using first name 
$contacts = Infusionsoft_DataService::query(new Infusionsoft_Contact(), array('FirstName' => $UserName)); 
$contact = array_shift($contacts); 

//This is the Contact ID 
$contactID = $contact->Id; 

//This is the Tag ID 
$groupID = 105; 

//Tag a user using the Contact ID and Tag ID 
Infusionsoft_ContactService::addToGroup($contactID , $groupID); 
+1

你應該進入一些你已經嘗試過的,以及遇到什麼障礙:http://www.sscce.org –

回答

0

我決定重新命名和重新解釋「第一名稱」字段(將其更改爲「用戶名」),而不是使用自定義的。

做這樣的說法我有一些代碼工作:

<?php 


// Include the SDK 
require_once('Infusionsoft/infusionsoft.php'); 

//Get username value from session 
$UserName = $_SESSION["Username"]; 


//Query contacts table using first name 
$contacts = Infusionsoft_DataService::query(new Infusionsoft_Contact(), array('FirstName' => $UserName)); 
$contact = array_shift($contacts); 


//This is the Contact ID 
$contactID = $contact->Id; 


//This is the Tag ID 
$groupID = 105; 


//Tag a user using the Contact ID and Tag ID 
Infusionsoft_ContactService::addToGroup($contactID , $groupID); 

// ---

這就是我的一切!

謝謝。

0
include('Infusionsoft/infusionsoft.php'); 
$contact = new Infusionsoft_Contact(); 
$contact->FirstName = 'John'; 
$contact->LastName = 'Doe'; 
$contact->save(); 


https://github.com/novaksolutions/infusionsoft-php-sdk/wiki/Examples 
相關問題