Hi there,
I am building my own extension which should send newly entered e-mail directly to Mautic. I am targeting that to be a Wordpress plugin (I know one exists, I am trying to build slightly different one)
I started by reading this:
https://www.mautic.org/blog/how-to-use-the-mautic-rest-api/
From that, I downloaded the API as ZIP file and included “lib” subdirectory to my directory plugin.
Now, when trying to authorise with Mautic, I start like this:
$edd_mautic_settings = array(
‘baseUrl’ => $global_options[‘mautic_base_url’],
‘clientKey’ => $global_options[‘mautic_public_key’],
‘clientSecret’ => $global_options[‘mautic_secret_key’],
‘callback’ => get_base_url(),
‘version’ => ‘OAuth1a’
);
$auth = MauticAuthApiAuth::initiate($edd_mautic_settings);
if ($auth->validateAccessToken()) {
if ($auth->accessTokenUpdated()) {
$accessTokenData = $auth->getAccessTokenData();
// @todo Save $accessTokenData
// @todo Display success authorization message
} else {
// @todo Display info message that this app is already authorized.
}
} else {
// @todo Display info message that the token is not valid.
}
}
Now, I know that code is pretty basic skeleton, but even running this, I am getting this error:
The 'ApiAuth.php' itself is something provided by the API zip file itself. The code around line 45 says this:
Seems to me that this piece code is trying to access the 'OAuth.php' file located in same directory, but is unable to.
I am pretty much clueless what should I do next in order to unblock this and see if I am getting correctly to mautic API. Thanks for help