# Pushing data from Mautic to Other external APIs

**URL:** <https://forum.mautic.org/t/pushing-data-from-mautic-to-other-external-apis/16709>\
**Category:** Development\
**Created:** [October 23, 2020, 8:46am UTC](https://forum.mautic.org/t/pushing-data-from-mautic-to-other-external-apis/16709 "2020-10-23T08:46:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ithrees](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ithrees/32/1136_2.png) [@ithrees](https://forum.mautic.org/u/ithrees)\
**Post date:** [October 23, 2020, 8:46am UTC](https://forum.mautic.org/t/pushing-data-from-mautic-to-other-external-apis/16709/1 "2020-10-23T08:46:47Z")

</div>

Dears,

I’m very new to Mautic and we started to using it recently.  
We came across with a requirement to push contact data (on specific cases) to a sales pipeline system in cloud which has it’s on APIs deployed.  
As we are investigating we found that the integration can be done using plugins or webhooks.  
I need to know is there any other way we can consume any external APIs from Mautic other than this plug-In and webhooks method ?

Expecting your guidelines for my situation.

Thank You & Kind Regards,  
Ithrees

---

<div class="post-metadata">

**Author:** ![EJL](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ejl/32/12155_2.png) [@EJL](https://forum.mautic.org/u/EJL)\
**Post date:** [October 23, 2020, 12:46pm UTC](https://forum.mautic.org/t/pushing-data-from-mautic-to-other-external-apis/16709/2 "2020-10-23T12:46:02Z")

</div>

> **[Mautic Developer Documentation](https://developer.mautic.org/#rest-api)**

---

<div class="post-metadata">

**Author:** ![ithrees](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ithrees/32/1136_2.png) [@ithrees](https://forum.mautic.org/u/ithrees)\
**Post date:** [October 26, 2020, 3:44am UTC](https://forum.mautic.org/t/pushing-data-from-mautic-to-other-external-apis/16709/3 "2020-10-26T03:44:53Z")

</div>

Hi EJL,

Thank you for your reply.  
If you have shared the URL documentation on available APIs which are to be used to connect Mautic from other applications, yes I got this.

But my requirement is to connect other sources from Mautic, Something like writing scripts in Mautic so I can consume external APIs of other services.

Thank You

---

<div class="post-metadata">

**Author:** ![danielhilst](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/danielhilst/32/2132_2.png) [@danielhilst](https://forum.mautic.org/u/danielhilst)\
**Post date:** [March 31, 2021, 3:18pm UTC](https://forum.mautic.org/t/pushing-data-from-mautic-to-other-external-apis/16709/4 "2021-03-31T15:18:04Z")

</div>

ithress it depends on how you want to trigger these API calls, since you said _script_ I would go by creating a custom command and then you can call `php bin/console your:custom:command` and at you command class you have access to all Mautic’s database and code

To create a custom command you need to create a `Command/YourCommand.php` file with something like

```auto
<?php

namespace MauticPlugin\YourBundle\Command;

use Mautic\CoreBundle\Command\ModeratedCommand;

/**
 * CLI command to process the e-mail queue.
 */
class YourCommandCommand extends ModeratedCommand
{
    protected function configure()
    {
        $this
            ->setName('your:custom:command');
        parent::configure();
    }

    public function __construct(/* inject dependences here and configure them at config.php*/)
    {
        parent::__construct();
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        // Your code here
        return 0;
    }
}

```

And register your command at `config.php`

```auto
    ...
    'services' => [
        'command' => [
            'mautic.yourbundle.command.yourcommand' => [
                'class' => 'MauticPlugin\YourBundle\Command\YourCommand',
                'arguments' => [
                    // Arguments to be injected on YourCommand contructor
                ],
            ]
        ],
...

```
