eduardoavargas / laravel-mautic
Access Api Mautic Oauth2 in laravel
Requires
- graham-campbell/manager: ^4.2
- guzzlehttp/guzzle: ^6.3.3
- mautic/api-library: 2.15.0
This package is not auto-updated.
Last update: 2024-11-05 19:40:29 UTC
README
#####Esse pacote é uma atualização e algumas motificações do pacote do Prince Ali Khan
https://github.com/princealikhan/laravel-mautic-api
Mautic Configurações
A API deve estar ativada no Mautic. No Mautic, vá para a página Configuração (localizada no menu Configurações) e, em Configurações da API, ative a API do Mautic. Você também pode escolher qual protocolo OAuth2 usar aqui. Depois de salvar a configuração, acesse a página Credenciais da API (localizada no menu Configurações) e crie um novo cliente. Insira o URI de retorno / retorno de chamada para o qual a solicitação será enviada. Clique em Aplicar e copie o ID do cliente e o Segredo do cliente para o aplicativo que usará a API.
Instalação
composer require eduardoavargas/laravel-mautic``` `php artisan vendor:publish` ## Configuration You need to add your `client id`, `client secret` and `callback url` in `mautic.php` file that is found in your applications `config` directory. ## Authorization This Library only support OAuth2 Authorization you must need to create a OAuth2 client in order to use api. ## Registering Application In order to register you application with mautic ping this url this is one time registration. ```url http://your-app/mautic/application/register
Usage
Add Mautic Facade in your controller.
use Mautic;
Send a request to mautic ( Example )
Create a new contact in mautic.
$params = array( 'firstname' => 'Eduardo', 'lastname'=> 'Ali Khan', 'email' => 'eduardo.a.vargas@gmail.com' ); 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');
And many more endpoints support by mautic.
List of Endpoints supported by Mautic.
Contacts
[ "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", "assets/{id}" ]
Campaigns
[ "campaigns", "campaigns/{id}", "campaigns/contact/{id}/add/{leadId}", "campaigns/contact/{id}/remove/{leadId}" ]
Data
[ "data", "data/{type}", ]
Emails
[ "emails", "emails/{id}", "emails/{id}/send", "emails/{id}/send/lead/{leadId}" ]
Forms
[ "forms", "forms/{id}" ]
Pages
[ "pages", "pages/{id}" ]
Points
[ "points", "points/{id}", "points/triggers", "points/triggers/{id}" ]
Reports
[ "reports", "reports/{id}" ]
Segments
[ "segments", "segments/contact/{id}/add/{leadId}", "segments/contact/{id}/remove/{leadId}" ]
Users
[ "roles", "roles/{id}", "users", "users/{id}", "users/list/roles", "users/self", "users/{id}/permissioncheck", ]
Please refer to Documentation. for all customizable parameters.