Laravel-Mautic-API is a free and open-source marketing automation API that connects Laravel or Lumen applications to Mautic. It enables marketing teams to automate campaigns, manage leads, and track customer interactions. The API integrates with Mautic's configuration settings and requires PHP 5.5 or newer with cURL support.
git clone https://github.com/princealikhan/laravel-mautic-api.gitThe laravel-mautic-api is a free and open-source marketing automation API designed to streamline the integration between Laravel applications and Mautic, a leading open-source marketing automation platform. This skill allows developers to automate marketing tasks, manage campaigns, and track customer interactions efficiently. By leveraging this API, teams can enhance their marketing workflows and improve overall productivity. One of the key benefits of the laravel-mautic-api is its ability to save time by automating repetitive marketing tasks. While specific time savings are currently unknown, the intermediate complexity of the implementation suggests that developers can expect a relatively quick setup time of approximately 30 minutes. This skill is particularly valuable for developers and product managers looking to enhance their marketing strategies without the need for extensive manual input. This skill is well-suited for marketing teams, developers, and AI practitioners who are involved in workflow automation. By integrating the laravel-mautic-api into their existing systems, users can create more efficient marketing campaigns, track performance metrics, and respond to customer needs in real-time. For instance, a marketing team could use this API to automatically segment their audience based on user behavior, allowing for more targeted and effective campaigns. Implementing the laravel-mautic-api requires an intermediate level of expertise in Laravel and familiarity with API integrations. As organizations increasingly adopt AI-first workflows, this skill becomes essential for automating marketing processes, enabling teams to focus on strategic initiatives rather than manual tasks. By incorporating the laravel-mautic-api into their tech stack, businesses can leverage the power of AI automation to optimize their marketing efforts.
1. **Install the Laravel-Mautic-API Package**: Run `composer require mautic/api-library` in your Laravel or Lumen project. Ensure your Mautic instance is accessible and your API credentials are configured. 2. **Configure API Credentials**: Set up the `baseUrl`, `clientKey`, and `clientSecret` in your Laravel environment file (`.env`). Example: ``` MAUTIC_BASE_URL=https://your-mautic-instance.com MAUTIC_CLIENT_KEY=your_client_key MAUTIC_CLIENT_SECRET=your_client_secret ``` 3. **Authenticate the API**: Use the `ApiAuth` class to authenticate your requests. This should be done once per session or request cycle. 4. **Select the API Endpoint**: Choose the appropriate Mautic API endpoint for your task (e.g., `SegmentsApi`, `ContactsApi`, `CampaignsApi`). Refer to the [Mautic API documentation](https://developer.mautic.org/) for endpoint details. 5. **Execute the Action**: Use the selected API class to perform your desired action (e.g., create, update, delete, or fetch data). Always validate the response to handle errors or edge cases. **Tips:** - Use Laravel’s `dd()` or `Log::debug()` to inspect API responses during development. - Cache API tokens to avoid repeated authentication requests. - For batch operations, use Laravel’s queue system to process large datasets efficiently.
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/princealikhan/laravel-mautic-apiCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Use the Laravel-Mautic-API to [ACTION] within Mautic for [ENTITY_TYPE]. [ENTITY_TYPE] could be contacts, campaigns, forms, or segments. For example: 'Use the Laravel-Mautic-API to create a new segment in Mautic called [SEGMENT_NAME] with the criteria [CRITERIA].' Include the Mautic API endpoint and any required fields or parameters in your response.
Here’s how I would use the Laravel-Mautic-API to create a new segment in Mautic for a SaaS company targeting high-value leads:
```php
use Mautic\MauticApi\Api\SegmentsApi;
use Mautic\MauticApi\Auth\ApiAuth;
// Configure Mautic API credentials
$settings = [
'baseUrl' => 'https://your-mautic-instance.com',
'version' => 'Api',
'clientKey' => 'your_client_key',
'clientSecret' => 'your_client_secret',
];
$auth = new ApiAuth($settings);
$api = new SegmentsApi($auth);
// Define segment criteria
$segmentData = [
'name' => 'High-Value SaaS Leads',
'alias' => 'high-value-saas-leads',
'publicName' => 'High-Value SaaS Leads',
'isPublished' => true,
'segmentType' => 'dynamic',
'filters' => [
[
'glue' => 'and',
'field' => 'leadpoints',
'operator' => 'gt',
'filter' => '1000',
],
[
'glue' => 'and',
'field' => 'company_size',
'operator' => 'in',
'filter' => ['Enterprise', 'Mid-Market'],
],
],
];
// Create the segment
$segment = $api->create($segmentData);
// Output the result
if (isset($segment['id'])) {
echo "Segment created successfully! ID: " . $segment['id'] . "\n";
echo "Segment URL: https://your-mautic-instance.com/segments/view/" . $segment['id'] . "\n";
} else {
echo "Failed to create segment. Error: " . json_encode($segment) . "\n";
}
```
**Result:**
The API call successfully created a dynamic segment named 'High-Value SaaS Leads' with the alias `high-value-saas-leads`. The segment includes contacts who have earned more than 1,000 lead points and belong to either the 'Enterprise' or 'Mid-Market' company size categories. The segment is now published and ready for use in campaigns or email automation workflows. You can view the segment in Mautic at the provided URL.Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan