Create an Integration
Create a custom Integration with which Connections can be created. To create a new Integration, you must provide your own application authentication parameters.
Learn More about Custom Integrations
Method Signature
create(string $name, string $type, array $config): Integration
Parameters
Parameter | Type | Description |
---|---|---|
$name | string | The display name to apply to the Integration |
$oauthConfig | IntegrationConfiguration | The oauth configuration settings for the integration |
returns | Integration | The created Integration |
IntegrationConfiguration
IntegrationConfiguration
Name | Type | Description |
---|---|---|
clientId | string | Client ID of the OAuth Application |
clientSecret | string | Client Secret of the OAuth Application |
tokenPath | string | Token Path of the OAuth Application |
revokePath | string | Token Revocation Path of the OAuth Application |
authorizeBaseUrl | string | The base URL of the OAuth Application |
site | string | The website of the OAuth Application |
scopes | string[] | The list of Scopes to apply to Connections using the Integration |
useBodyAuth | boolean | Boolean indicating whether auth params should be sent to OAuth app in body |
Example
<?php
/*
* This example demonstrates creating a custom Integration
*/
require_once(__DIR__ . './vendor/autoload.php');
use Catalytic\SDK\CatalyticClient;
use Catalytic\SDK\Entities\IntegrationType;
$catalytic = new CatalyticClient();
$oauthConfig = array(
'clientId' => 'MY_OAUTH_CLIENT_ID',
'clientSecret' => 'MY_OAUTH_CLIENT_SECRET',
'tokenPath' => '/oauth2/token',
'revokePath' => '/oauth2/revoke',
'authorizeBaseUrl' => 'https://example-oauth-app.com/oauth2/authorize',
'site' => 'https://api.example-oauth-app.com',
'scopes' => array('read', 'write'),
'useBodyAuth' => false
);
$integration = $catalytic->integrations()->create('My Custom Integration', $oauthConfig);
echo $integration->getName() . ":" . PHP_EOL;
Updated almost 3 years ago