簡體   English   中英

Infusionsoft:是否可以通過API調用添加新聯系人?

[英]Infusionsoft: Is it possible to add a new contact through an API call?

我有2個CRM-一個是基於Infusionsoft構建的,另一個是自定義的。

我想在這兩個CRMS之間同步聯系人。 從定制版本到Infusionsoft版本都是單向的。 因此,當客戶在自定義CRM上注冊時,我想將他/她的信息添加到Infusionsoft CRM中,而無需客戶意識到它=)

Infusionsoft API使用oAuth2身份驗證,從理論上講,這意味着“ I have to ask the user to enter my username and password for Infusionsoft to get them added to my Infusionsoft CRM ”-據我所知,這很荒謬。

我確實相信我要做的事情並非不可能.....也許我錯了。 在最壞的情況下,我可以使用PhantomJS通過oAuth身份驗證。 如果有其他解決方案,我不想使用PhantomJS。 我需要Infusionsoft專家的幫助。 請指教。 可能嗎?

每個Infusionsoft帳戶都有一個API密鑰,可讓您調用該API。

以下是獲取Infusionsoft應用程序的API密鑰的說明。 http://ug.infusionsoft.com/article/AA-00442/0/Infusionsoft-API-Key.html

獲得密鑰后,您可以使用PHP SKD進行呼叫和添加聯系人。 這是infusionosft php SDK的鏈接: https : //github.com/infusionsoft/infusionsoft-php

這是指向文檔的鏈接,用於添加聯系人以及php示例: https : //developer.infusionsoft.com/docs/xml-rpc/#contact

https://github.com/infusionsoft/API-Sample-Code/blob/master/PHP/ContactService-Sample.php

編輯看起來好像它們最終將在將來取消帳戶級密鑰,而這不需要您使用oauth。 https://developer.infusionsoft.com/2014/07/03/simplifying-infusionsoft-authentication-with-oauth2/

這里有很多關於如何在Infusionsoft中使用oauth的示例: https : //developer.infusionsoft.com/docs/xml-rpc/#contact

單擊右側的PHP,您將看到如何獲取令牌並使用API​​創建聯系人

github上的README上還有更多示例:

https://github.com/infusionsoft/infusionsoft-php/blob/master/README.md

認證方式:

$infusionsoft = new \Infusionsoft\Infusionsoft(array(
    'clientId'     => 'XXXXXXXXXXXXXXXXXXXXXXXX',
    'clientSecret' => 'XXXXXXXXXX',
    'redirectUri'  => 'http://example.com/',
));

// If the serialized token is available in the session storage, we tell the SDK
// to use that token for subsequent requests.
if (isset($_SESSION['token'])) {
    $infusionsoft->setToken(unserialize($_SESSION['token']));
}

// If we are returning from Infusionsoft we need to exchange the code for an
// access token.
if (isset($_GET['code']) and !$infusionsoft->getToken()) {
    $infusionsoft->requestAccessToken($_GET['code']);
}

if ($infusionsoft->getToken()) {
    // Save the serialized token to the current session for subsequent requests
    $_SESSION['token'] = serialize($infusionsoft->getToken());

    // MAKE INFUSIONSOFT REQUEST
} else {
    echo '<a href="' . $infusionsoft->getAuthorizationUrl() . '">Click here to authorize</a>';
}

實際上,您不需要每次都在oAuth2中要求客戶進行身份驗證。 僅應用程序的所有者需要進行一次身份驗證。 它確實涉及存儲令牌(在數據庫或php文件中),以便您可以刷新令牌,因為令牌會在8小時后失效。

上面的代碼是正確的,但是它不存儲令牌,因此您需要在會話關閉后進行身份驗證。

http://community.infusionsoft.com/showthread.php/19009-OAuth2-unattended-authentication-process?highlight=storing+token

這是一個很好的鏈接,可以幫助您走上正確的路,談論有關為所需進程類型存儲令牌的操作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM