1. Go to this page and download the library: Download apli/integration-rdstation library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
apli / integration-rdstation example snippets
use Apli\Integration\RdStation\Provider\RdStation;
$this->oauthProvider = new RdStation([
'clientId' => Env::get('RDSTATION_CLIENT_ID'),
'clientSecret' => Env::get('RDSTATION_CLIENT_SECRET'),
'redirectUri' => url('auth/rdstation/callback'),
]);
$this->oauthProvider->authorize();
use Apli\OAuth2\Client\Auth\Tokens\AccessTokenInterface;
use Apli\OAuth2\Client\Support\Utils\GrantType;
/** @var AccessTokenInterface $accessToken */
$accessToken = $this->oauthProvider->getAccessToken(GrantType::AUTHORIZATION_CODE, [
'code' => $request->get('code')
]);
use Apli\Integration\RdStation\Provider\RdStationAccount;
$rdstationAccount = $this->oauthProvider->getResourceOwner($accessToken);
$contact = $rdstationAccount->contacts()->getByIdentifier('[email protected]');
or you can use uuid
$contact = $rdstationAccount->contacts()->getByIdentifier('11111111-1111-1111-1111-111111111111');
$funnel = $rdstationAccount->funnels()->getByIdentifier('[email protected]');
// or you can use uuid
$funnel = $rdstationAccount->funnels()->getByIdentifier('11111111-1111-1111-1111-111111111111');
use Apli\Integration\RdStation\Entities\Funnel;
$funnel->setLifecycleStage(Funnel::STAGE_LEAD);
$rdstationAccount->funnels()->put('[email protected]', $funnel);
// or you can use uuid
$rdstationAccount->funnels()->put('11111111-1111-1111-1111-111111111111', $funnel);
use Apli\Integration\RdStation\Entities\Event;
$event = new Event(
Event::FAMILY_CDP,
Event::TYPE_CONVERSION,
[
'conversion_identifier' => 'conversionName',
'email' => '[email protected]'
]
);
$rdstationAccount->events()->post($event);