Code Monkey home page Code Monkey logo

developer-documentation's Introduction

This documentation is deprecated. Use https://github.com/mautic/developer-documentation-new instead.

Mautic Developer Documentation

Developer documentation for Mautic.

The content is published at https://developer.mautic.org.

It is generated using Slate, a great API documentation generator. The content of Mautic's documentation is located in the source/includes folder.

Updating the live documentation

The live documentation at https://developer.mautic.org is updated automatically using GitHub Actions when a new commit is pushed to master.

developer-documentation's People

Contributors

alanhartless avatar bootstraponline avatar chrissrogers avatar creaoticx avatar dakur avatar dcoutelle avatar dennisameling avatar dependabot[bot] avatar dongilbert avatar drmmr763 avatar escopecz avatar galvani avatar imrodmartin avatar isleshocky77 avatar kevin-buttercoin avatar kuzmany avatar lan-laurene avatar lord avatar luk4s avatar madmath03 avatar markll avatar naomicbush avatar npracht avatar rcheesley avatar renjith341 avatar rlord avatar scottshipman avatar that0n3guy avatar tomekkowalczyk avatar woeler avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

developer-documentation's Issues

M3 - Remove CommonSubscriber from examples

In Mautic 3, the CommonSubscriber is removed, which was the recommended way to listen for events in Mautic 2.x. See UPGRADE-3.0.md for details.

The docs will need an update to reflect this change.

Previously, the code would have looked like:

<?php

namespace MauticPlugin\MyPluginBundle\EventListener;

use Mautic\LeadBundle\LeadEvents;
use Mautic\LeadBundle\Event\LeadEvent;
use Mautic\CoreBundle\EventListener\CommonSubscriber;

class LeadPostSaveSubscriber extends CommonSubscriber {
     /**
     * @return array
     */
    static public function getSubscribedEvents()
    {
        return array(
            LeadEvents::LEAD_POST_SAVE     => array('onLeadPostSave', 0),
        );
    }

    public function onLeadPostSave(LeadEvent $event)
    {
        $lead = $event->getLead();
        // Some logic here
    }
}

Now, the code should look like:

<?php

namespace MauticPlugin\MyPluginBundle\EventListener;

use Mautic\LeadBundle\LeadEvents;
use Mautic\LeadBundle\Event\LeadEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class LeadPostSaveSubscriber implements EventSubscriberInterface {
    /**
     * @return array
     */
    static public function getSubscribedEvents()
    {
        return array(
            LeadEvents::LEAD_POST_SAVE     => array('onLeadPostSave', 0),
        );
    }

    public function onLeadPostSave(LeadEvent $event)
    {
        $lead = $event->getLead();
        // Some logic here        
    }
}

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

M3 - Config event subscriber needs an update in dev docs

This page in the docs explains how plugins can hook into Mautic's configuration section in the UI. The function onConfigGenerate() is key here. In Mautic 3, the way this is done has been changed, so we need to update the docs. All details about how it should be in M3 can be found in UPGRADE-3.0.md.

In short, for Mautic 2.x it was:

public function onConfigGenerate(ConfigBuilderEvent $event)
{
    $event->addForm([
        'bundle'     => 'EmailBundle',
        'formAlias'  => 'emailconfig',
        'formTheme'  => 'MauticEmailBundle:FormTheme\Config',
        'parameters' => $event->getParametersFromConfig('MauticEmailBundle'),
    ]);
}

... now it should be something like (note formType was added):

public function onConfigGenerate(ConfigBuilderEvent $event)
{
    $event->addForm([
        'bundle'     => 'EmailBundle',
        'formType'   => ConfigType::class,
        'formAlias'  => 'emailconfig',
        'formTheme'  => 'MauticEmailBundle:FormTheme\Config',
        'parameters' => $event->getParametersFromConfig('MauticEmailBundle'),
    ]);
}

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Typo at writting plugin docs

There is something that looks a lot like a typo at docs

image

I search for CHANGE CHANGE in github search but can't find the document with the typo, I willing to create a PR for it.

Regards

Plugin integration services must start with `mautic.integration.` (undocumented)

Just broke my head for two hours over why my plugin icon + settings didn't show up in Mautic's plugin page.

Turns out that every integration HAS to be registered as mautic.integration.NAME (EXAMPLE), and it's currently mentioned incorrectly in the Integration Framework docs:

image

These names need to be the EXACT same for it to work:

  • mautic.integration.helloworld (lowercase) in Config/config.php
  • File name: Integration/HelloWorldIntegration.php (including the class name HelloWorldIntegration)

Without proper naming, the plugin IS registered and activated, but has the default icon because the integration isn't recognized (note: the config options also don't show up):

image

With proper naming, the plugin is correctly recognized as an integration and things like the icon/config options all show up:

image

This is the code in Mautic that's responsible for this behavior:

https://github.com/mautic/mautic/blob/7a2875bc16a6de50a1803fbc41b64278ae9b5428/app/bundles/PluginBundle/Helper/IntegrationHelper.php#L292-L300

Since integrations should now be tagged with mautic.basic_integration in the IntegrationBundle, we could simply get all services that are tagged with mautic.basic.integration in the container, and get their keys dynamically. This would be a breaking change that we could introduce in Mautic 4. What do you think @alanhartless?


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

the statistics of a campaign: sent - opened - unsubscribed - clicked - bounced

find the statistics of a campaig: the contacts to send and the contacts who opened the email ... (sent - opened - unsubscribed - clicked - bounced).
OR retrieve contacts(sent - opened - unsubscribed - clicked - bounced) after sending an email. recovery will be by campaignId.

PHP 7.2
Mautic 3.0.1

$MauticAPI= $api->newApi("data", $auth, $apiUrl);
$limit = 30;
$offset = 0;
$option = ['dateFrom' => "2020-09-25", 'dateTo' => "2020-10-22", 'timeUnit' => "m", 'filter' => ['campaignId' => $Campaign_id], 'dataset' => ['send', 'opened', 'unsubscribed', 'clicked', 'bounced'], 'limit' => $limit, 'offset' => $offset];
$WIDGETS = $MauticAPI->get('emails.in.time', $option );

Result -> {"success":1,"cached":false,"execution_time":0.009031057357788086,"data":{"chartType":"line","chartHeight":220,"chartData":{"labels":["Sep 2020","Oct 2020"],"datasets":[{"label":"Sent emails","data":[0,6],"backgroundColor":"rgba(78,93,157,0.1)","borderColor":"rgba(78,93,157,0.8)","pointHoverBackgroundColor":"rgba(78,93,157,0.75)","pointHoverBorderColor":"rgba(78,93,157,1)"},{"label":"Read emails","data":[0,0],"backgroundColor":"rgba(0,180,156,0.1)","borderColor":"rgba(0,180,156,0.8)","pointHoverBackgroundColor":"rgba(0,180,156,0.75)","pointHoverBorderColor":"rgba(0,180,156,1)"},{"label":"Clicked","data":[0,0],"backgroundColor":"rgba(253,149,114,0.1)","borderColor":"rgba(253,149,114,0.8)","pointHoverBackgroundColor":"rgba(253,149,114,0.75)","pointHoverBorderColor":"rgba(253,149,114,1)"},{"label":"Unsubscribed","data":[0,0],"backgroundColor":"rgba(253,185,51,0.1)","borderColor":"rgba(253,185,51,0.8)","pointHoverBackgroundColor":"rgba(253,185,51,0.75)","pointHoverBorderColor":"rgba(253,185,51,1)"},{"label":"Bounced","data":[0,0],"backgroundColor":"rgba(117,117,117,0.1)","borderColor":"rgba(117,117,117,0.8)","pointHoverBackgroundColor":"rgba(117,117,117,0.75)","pointHoverBorderColor":"rgba(117,117,117,1)"}]}}}

for exemple: Sent emails
{"label":"Sent emails","data":[0,6], -> it means that the email is sent to 6 contacts
I don't want to have the number of contacts who received the emails, but the IDs of the contacts.

can someone help me in this shots ? THX


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Improve plugin install/upgrade docs

There is a section in the docs called "Install/Upgrade" for plugin developers.

This section has a large deprecation notice in it now:

THIS IS NOW DEPRECATED AND DISCOURAGED FROM USE. USE THE INTEGRATION FRAMEWORK’S MIGRATION INSTEAD.

However, the "Install/Upgrade" section is not only for developers who want to add database migrations. It can also be used in the installation process to check if certain dependencies are installed, etc.

We should merge the docs for "Install/Upgrade" and the new Integration Framework and mention the following:

  • You can use onPluginInstall(), onPluginUpdate, etc. to check things during the installation process
  • Do you need to add custom tables to the database? Use the new isApplicable() and up() methods that the IntegrationsBundle makes available.

image


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Models section has old reference to CommonModel

The models section has an old reference to CommonModel:

<?php
// plugins/HelloWorldBundle/Model/ContactModel.php

namespace MauticPlugin\HelloWorldBundle\Model;

use Mautic\CoreBundle\Model\CommonModel;

class ContactModel extends CommonModel
{

CommonModel should be replaced by AbstractCommonModel. The text already correctly mentions AbstractCommonModel, but the code example doesn't.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Unable to load dynamic library 'mysqli'

I have upgrade to version 3.0.1.
php 7.2
php var/www/html/mautic/bin/console mautic:segments:update
earlier, worked fine. but now after the upgrade I got an error.
PHP Warning: PHP Startup: Unable to load dynamic library 'mysqli' (tried: /usr/lib/php/20170718/mysqli (/usr/lib/php/20170718/mysqli: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/mysqli.so (/usr/lib/php/20170718/mysqli.so: undefined symbol: mysqlnd_global_stats)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_mysql' (tried: /usr/lib/php/20170718/pdo_mysql (/usr/lib/php/20170718/pdo_mysql: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pdo_mysql.so (/usr/lib/php/20170718/pdo_mysql.so: undefined symbol: pdo_parse_params)) in Unknown on line 0
Could not open input file: var/www/html/mautic/bin/console


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

[REST-API] Example incorrect

Hey there 👋

It seems like the example URL given for advanced filtering on the /api/contacts endpoint is invalid.
When I try to cURL it to my Mautic 3.3.2 instance, it just throws a 500 error.

The URL in the documentation is: https://[your_mauitc_domain]/api/contacts?where%5B0%5D%5Bcol%5D=phone&where%5B0%5D%5Bexpr%5D=in&where%5B0%5D%5Bval%5D=444444444,888888888 (yes, that typo is in there too)
URL-Decoding the query string results in this: where[0][col]=phone&where[0][expr]=in&where[0][val]=444444444,888888888

This should evaluate to this JSON

{
  "where": [
    {
      "col": "phone",
      "expr": "in",
      "val": "444444444,888888888"
    }
  ]
}

This is the error logged to my log files:

[2021-06-10 09:31:50] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: ""expr" is missing in the where clause array." at /var/www/html/app/bundles/CoreBundle/Entity/CommonRepository.php line 852 {"exception":"[object] (InvalidArgumentException(code: 0): \"expr\" is missing in the where clause array. at /var/www/html/app/bundles/CoreBundle/Entity/CommonRepository.php:852)"} []

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Campaing decision docs are outdated

Hi,

I had to write a custom decision at my work and found that the documentation is outdated. I could achieve my task after a lot of effort to understand how things works, and documented my journey in a forum post.

It would be nice if any developer could review the approach to check that I'm not doing anything stupid, when I got things right I would like to contribute to the documentation to update this part so that other users don't need to have the effort that I had.

The forum post is here: https://forum.mautic.org/t/documentation-on-campaign-decision-outdated-if-so-how-to-trigger-a-decision-from-a-custom-api-endpoint/18789/3

The outdated documentation is here https://developer.mautic.org/#extending-campaigns, and here is the example from the docs that I couldn't make work
image


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

An exception occurred while executing 'UPDATE lead_event_log

I wrote a plugin that updates an existing contact. After upgrading to the latest version of Mautic my plugin now fails with the following error.

An exception occurred while executing 'UPDATE lead_event_log SET lead_id = 0 WHERE lead_id = 96':

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (mautic_db.lead_event_log, CONSTRAINT FK_753AF2E55458D FOREIGN KEY (lead_id) REFERENCES leads (id) ON DELETE CASCADE)

Wrong lead delete URL in REST API docs

The docs state (excerpt below) that lead delete URL for REST API is /leads/{id}, which is incorrect (and very confusing).

HTTP Request DELETE /leads/ID

The correct URL for REST API seems to be DELETE /leads/ID/delete.

OAUTH 1a's example code is broken

https://developer.mautic.org/?php#oauth-1a
oauth-1a's example code is broken.
$settings['version'] need comma

now

$settings = array(
    'baseUrl'      => 'https://your-mautic.com',
    'version'      => 'OAuth1a'
    'clientKey'    => '5ad6fa7asfs8fa7sdfa6sfas5fas6asdf8',
    'clientSecret' => 'adf8asf7sf54asf3as4f5sf6asfasf97dd',
    'callback'     => 'https://your-callback.com'
);

Except

$settings = array(
    'baseUrl'      => 'https://your-mautic.com',
    'version'      => 'OAuth1a',
    'clientKey'    => '5ad6fa7asfs8fa7sdfa6sfas5fas6asdf8',
    'clientSecret' => 'adf8asf7sf54asf3as4f5sf6asfasf97dd',
    'callback'     => 'https://your-callback.com'
);

API - List Contacts Companies - Search Parameter

Q A
Bug report? No
Feature request? Yes
Enhancement? No

Description:

Currently the REST API for companies listing is not filterable !
https://developer.mautic.org/#list-contact-companies

It asks ages to get a list from Mautic that owns hundred of thousands companies !

As it is already implemented in Contacts, it would be great to have the same possibilities with Companies to have the same level of functionalities whatever we want to deal / sync contacts or companies

If a bug:

Q A
Mautic version 2.9.2
PHP version 7.0.12

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

data-slots list and definitions

Hi,

It would be great to add the informations about each type of data-section/slot etc in the documentation.
because it's written nowhere what is actually existing.

Thanks.

No refresh token expiry date

Hello, is there any way of getting the Refresh token expiry date ? i need that date to remind the user to reauthorize

developer.mautic.org show deprecated way to send email to contact along with wrong HTTP verb

This section of the documentation shows the deprecated way to send emails to contact along with the wrong HTTP verb

On the website:

Send Email to Contact

Send a predefined email to existing contact.

HTTP Request

DELETE /emails/ID/send/contact/CONTACT_ID

Response

Expected Response Code: 200

Properties json { "success": 1 }

In Mautic's configuration:

'mautic_api_sendcontactemail' => [
    'path'       => '/emails/{id}/contact/{leadId}/send',
    'controller' => 'MauticEmailBundle:Api\EmailApi:sendLead',
    'method'     => 'POST',
],

Documenting contact tags removal

It would be nice if feature for removing tags from contact via API by adding - before a tag in PUT request was documented. I'm willing to do it, but I would like to hear some suggestions on where exactly that should be added.

Improve docummentation for JS Form Processing Hooks

In the documentation, there's the following statement:

"In the example code replace replaceWithFormName with the name of your form."

Reading this, it was not clear to me what should I replace it with. After digging into the code and quite a few tests, I believe 'replaceWithFormName' must be replaced with the name of the form (as defined in the admin panel of mautic), in lowercase and without whitespacess.

For example, if the form name is "Newsletter Signup", you'd need to replace replaceWithFormName with "newslettersignup":

MauticFormCallback['newslettersignup'] = {...}

I would be great if you can please update the documentation to make it more clear.

Thanks in advance.


Affects the following URLs:

https://github.com/mautic/developer-documentation/blob/master/source/includes/_mauticjs_api_intro.md#js-form-processing-hooks

https://developer.mautic.org/#js-form-processing-hooks


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Explain how to execute Mautic actions in plugins

Something that I think is significantly missing from the plugin documentation is a description of how to execute common functions that Mautic already is coded to do, but that a plugin may need to initiate itself. Here are a couple of examples.

  1. I was thinking of creating a plugin that could be pinged when new content was published to a site and then email all leads or a segment of leads what the new content is about with a link to read further. Mautic already has the functionality to create emails built in, however the docs don't explain how to do this.
  2. I'm trying to build a plugin that accepts lead data from an external source. This lead data has additional data that I want to be included in the lead record, and I want to put it in as three custom fields. The documentation explains how to add fields to forms, but not how to create custom fields.
  3. I know there has been talk about exporting campaigns so that they can be shared. However, another option would be to create a plugin that is programmed to create predesigned campaigns and anytime a user wants to create a new campaign of a specific type they just go to the plugin and tell it to create it. The plugin adds all the campaign elements with placeholders and then the user can go into campaign and customize it as needed.

I'm think the docs needs a section called 'Executing Default Mautic Actions' or something that explains how to do these types of things from a plugin like adding a form, custom field, email, etc. I'm willing to start creating it, but I'll probably have lots of questions since I'm just starting to work my way through figuring out the Mautic code. I just wanted to see what other people's thoughts were or if there was a reason this type of information isn't included in the documentation already.

Thanks.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.