PHP code example of xavicabot / filament-activecampaign
1. Go to this page and download the library: Download xavicabot/filament-activecampaign 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/ */
xavicabot / filament-activecampaign example snippets
use XaviCabot\FilamentActiveCampaign\Facades\ActiveCampaign;
// Get existing tag or create if it doesn't exist
$tag = ActiveCampaign::getOrCreateTag('VIP Customer');
// With description (only used if creating)
$tag = ActiveCampaign::getOrCreateTag('Premium Member', 'Users with premium subscription');
// The returned $tag is an ActiveCampaignTag model instance
echo $tag->ac_id; // ActiveCampaign ID
echo $tag->name; // Tag name
echo $tag->description; // Optional description
// Only use if you're sure the tag doesn't exist
$tag = ActiveCampaign::createTag('New Tag', 'Description');
use XaviCabot\FilamentActiveCampaign\Facades\ActiveCampaign;
// Find a contact by email (returns null if it does not exist)
$contact = ActiveCampaign::getContactByEmail('[email protected]');
// Attach one tag
ActiveCampaign::addTagToContact($contact['id'], 'vip');
// Attach several tags in one call
ActiveCampaign::addTagToContact($contact['id'], ['vip', 'beta-tester']);
// Attach a tag by its ActiveCampaign id (no name lookup)
ActiveCampaign::addTagToContactByTagId($contact['id'], '55');
// List all tag associations for a contact (every page)
$associations = ActiveCampaign::getContactTags($contact['id']);
// Detach a tag by name or by id (no-op if it is not attached)
ActiveCampaign::removeTagFromContact($contact['id'], 'beta-tester');
ActiveCampaign::removeTagFromContactByTagId($contact['id'], '55');
use XaviCabot\FilamentActiveCampaign\Facades\ActiveCampaignAutomations;
ActiveCampaignAutomations::triggerWithEmail('newsletter.signup', '[email protected]');
'async' => false, // Set to true to dispatch all triggers to queue
'queue' => 'default', // Queue name
'async_tries' => 3, // Max retry attempts
'async_backoff' => [10, 60], // Backoff in seconds between retries
// These will be queued automatically when async is enabled
ActiveCampaignAutomations::trigger('user.registered', $user);
ActiveCampaignAutomations::triggerWithEmail('newsletter.signup', '[email protected]');
// Always queued, even if async config is false
ActiveCampaignAutomations::triggerAsync('user.registered', $user, ['plan' => 'pro']);
ActiveCampaignAutomations::triggerWithEmailAsync('lead.captured', '[email protected]', [
'firstName' => 'Jane',
], [
'source' => 'landing-page',
]);
use XaviCabot\FilamentActiveCampaign\Facades\ActiveCampaignAutomations;
public function register(Request $request)
{
$user = User::create([...]);
ActiveCampaignAutomations::trigger('user.registered', $user);
return $user;
}