AmoCRM PHP API/oAuth Client
$bots = $amo->salesbots()->get($page = 1, $limit = 250);
$bots = $amo->salesbots;
$start = $amo->salesbots()->start($bot_id, $entity_id, $entity_type = 2);
$stop = $amo->salesbots()->stop($bot_id, $entity_id, $entity_type = 2);
searchByCustomField searchByPhone searchByEmail searchByName
Вместе с обновлением на новую версию, необходимо заменить (если используется):
\Ufee\Amo\Collections\QueryCollection::setCachePath('path_to/cache');
На новый формат:
$apiClient->queries->setCacheStorage(
new \Ufee\Amo\Base\Storage\Query\FileStorage($apiClient, ['path' => 'path_to/cache'])
);
Или:
$redis = new \Redis();
$redis->connect('/var/run/redis/redis.sock');
$redis->setOption(\Redis::OPT_SERIALIZER, \Redis::SERIALIZER_PHP); // \Redis::SERIALIZER_IGBINARY recommended
$redis->select(5); // switch to specific db
$apiClient->queries->setCacheStorage(
new \Ufee\Amo\Base\Storage\Query\RedisStorage($apiClient, ['connection' => $redis])
);
$amo->queries->onResponseCode(429, function($query) {
echo 'Resp code 429, retry '.$query->retries."\n";
});
Execute api query:
$fp = fopen('path/debug.log', 'w+');
$query = new \Ufee\Amo\Api\Oauth\Query($crm);
$query->setMethod('GET');
$query->setUrl('/api/v4/contacts');
$query->verbose($fp);
$query->execute();
And check debug.log
$cfs = $amo->account->customFields->catalogs->get(6897);
$cf = $cfs->find('field_type', 18)->first();
print_r($cf->values_tree);
$lead = $this->amo->leads()->find(31975373);
print_r($lead->customFields->byTypeId(4));