Package Data | |
---|---|
Maintainer Username: | keepcloud |
Maintainer Contact: | princealikhan08@gmail.com (Prince Ali Khan) |
Package Create Date: | 2020-06-23 |
Package Last Update: | 2024-03-27 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-09 15:06:54 |
Package Statistics | |
---|---|
Total Downloads: | 50 |
Monthly Downloads: | 3 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 1 |
Total Forks: | 2 |
Total Open Issues: | 1 |
Free and Open Source Marketing Automation API
The API must be enabled in Mautic. Within Mautic, go to the Configuration page (located in the Settings menu) and under API Settings enable Mautic's API. You can also choose which OAuth2 protocol to use here. After saving the configuration, go to the API Credentials page (located in the Settings menu) and create a new client. Enter the callback/redirect URI that the request will be sent from. Click Apply then copy the Client ID and Client Secret to the application that will be using the API.
First, you'll need to require the package with Composer:
composer require keepcloud/laravel-mautic-api
Aftwards, run composer update
from your command line.
Then, update config/app.php
by adding an entry for the service provider.
'providers' => [
// ...
'Keepcloud\Mautic\MauticServiceProvider',
],
Then, register class alias by adding an entry in aliases section
'aliases' => [
//.....
'Mautic' => 'Keepcloud\Mautic\Facades\Mautic',
],
Finally, from the command line run php artisan vendor:publish
to publish the default configuration file.
This will publish a configuration file name mautic.php
,consumer migration
and consumer model
.
Run php artisan migrate
migration command to create consumer table in your database.
You need to add your client id
, client secret
and callback url
in mautic.php
file that is found in your applications config
directory.
This Library only support OAuth2 Authorization you must need to create a OAuth2 client in order to use api.
In order to register you application with mautic ping this url this is one time registration.
http://your-app/mautic/application/register
Add Mautic Facade in your controller.
use Mautic;
Create a new contact in mautic.
$params = array(
'firstname' => 'Edison',
'lastname'=> 'Costa',
'email' => 'edison@keepcloud.io'
);
Mautic::request('POST','contacts/new',$params);
Get List of all contacts
Mautic::request('GET','contacts');
Get a unique contact
Mautic::request('GET','contacts/1');
//where 1 is unique id for a contact.
Delete a contact
Mautic::request('Delete','contacts/1/delete');
[
"contacts",
"contacts/{id}",
"contacts/list/fields",
"contacts/list/owners",
"contacts/new",
"contacts/{id}/edit",
"contacts/{id}/delete",
"contacts/{id}/notes",
"contacts/{id}/segments",
"contacts/{id}/campaigns"
]
[
"assets",
"assets/{id}"
]
[
"campaigns",
"campaigns/{id}",
"campaigns/contact/{id}/add/{leadId}",
"campaigns/contact/{id}/remove/{leadId}"
]
[
"data",
"data/{type}",
]
[
"emails",
"emails/{id}",
"emails/{id}/send",
"emails/{id}/send/lead/{leadId}"
]
[
"forms",
"forms/{id}"
]
[
"pages",
"pages/{id}"
]
[
"points",
"points/{id}",
"points/triggers",
"points/triggers/{id}"
]
[
"reports",
"reports/{id}"
]
[
"segments",
"segments/contact/{id}/add/{leadId}",
"segments/contact/{id}/remove/{leadId}"
]
[
"roles",
"roles/{id}",
"users",
"users/{id}",
"users/list/roles",
"users/self",
"users/{id}/permissioncheck",
]
Please refer to Documentation. for all customizable parameters.