# Custom Integration service not able to get keys from saved encrypted settings

**URL:** <https://forum.mautic.org/t/custom-integration-service-not-able-to-get-keys-from-saved-encrypted-settings/13330>\
**Category:** Development\
**Tags:** discussion\
**Created:** [March 11, 2020, 12:51pm UTC](https://forum.mautic.org/t/custom-integration-service-not-able-to-get-keys-from-saved-encrypted-settings/13330 "2020-03-11T12:51:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mayanktiwaridotcom](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mayanktiwaridotcom/32/1501_2.png) [@mayanktiwaridotcom](https://forum.mautic.org/u/mayanktiwaridotcom)\
**Post date:** [March 11, 2020, 12:51pm UTC](https://forum.mautic.org/t/custom-integration-service-not-able-to-get-keys-from-saved-encrypted-settings/13330/1 "2020-03-11T12:51:34Z")

</div>

Hi Mautic Community Folks,

I have been facing a stupid issue, I have developed integration plugin to connect to third party application but the issue is that when I inject this service in my controller or event listener, I am not really getting to use it completely.

Let’s go step by step so I am able to describe my problem better:

here’s how my config looks:  
‘services’ =\> [  
‘events’ =\> [  
‘mautic.integration.appname.form.subscriber’ =\> [  
‘class’ =\> \MauticPlugin\MauticAppnameBundle\EventListener\OnboardingFormSubscriber::class,  
‘arguments’ =\> [  
‘monolog.logger’,  
‘session’,  
‘doctrine.orm.default\_entity\_manager’  
‘mautic.integration.appname’  
]  
]  
],  
‘integrations’ =\> [  
‘mautic.integration.appname’ =\> [  
‘class’ =\> \MauticPlugin\MauticAppnameBundle\Integration\AppnameIntegration::class,  
‘arguments’ =\>   
]  
],  
]

My Purpose: Once user is authenticated I need to push some data on specific event, for which I wrote the EventListeners and when in event listener I do:  
$this-\>appnameService-\>getKeys();

I receive nothing, while I have found a workaround for now but it doesn’t seems right to go like this, I have taken references from multiple plugins like SocialBundle and CrmBundle as well as referred to the documentation exactly it doesn’t seems fit.

For the workaround I dig in the core bundles and found out this:  
/\*\* @var \Mautic\PluginBundle\Helper\IntegrationHelper $integrationHelper _/  
$integrationHelper = $this-\>get(‘mautic.helper.integration’);  
/_\* @var AbstractIntegration $integrationObject \*/  
return $integrationHelper-\>getIntegrationObject(’’);

This works fine at some level for example in controller but in the injected service or form event it gives me issues becuase then I am injecting the container object in the Subscriber as well.

Can somebody point me in the right direction please ?

Regards,  
Mayank

Edit:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/5/50387f5246000e6fddd8163c44a135dbcfce4449.jpeg)

here is an example of when used service obtained from container vs when used the object obtained from integration helper.
