PHP code example of ai-apimatic / slack-apimatic-sdk

1. Go to this page and download the library: Download ai-apimatic/slack-apimatic-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ai-apimatic / slack-apimatic-sdk example snippets


use SlackWebApiLib\Logging\LoggingConfigurationBuilder;
use SlackWebApiLib\Logging\RequestLoggingConfigurationBuilder;
use SlackWebApiLib\Logging\ResponseLoggingConfigurationBuilder;
use Psr\Log\LogLevel;
use SlackWebApiLib\Environment;
use SlackWebApiLib\Authentication\AuthorizationCodeAuthCredentialsBuilder;
use SlackWebApiLib\Models\OauthScope;
use SlackWebApiLib\SlackWebApiClientBuilder;

$client = SlackWebApiClientBuilder::init()
    ->authorizationCodeAuthCredentials(
        AuthorizationCodeAuthCredentialsBuilder::init(
            'OAuthClientId',
            'OAuthClientSecret',
            'OAuthRedirectUri'
        )
            ->oauthScopes(
                [
                    OauthScope::ADMIN,
                    OauthScope::ADMIN_APPSREAD
                ]
            )
    )
    ->environment(Environment::PRODUCTION)
    ->loggingConfiguration(
        LoggingConfigurationBuilder::init()
            ->level(LogLevel::INFO)
            ->requestConfiguration(RequestLoggingConfigurationBuilder::init()->body(true))
            ->responseConfiguration(ResponseLoggingConfigurationBuilder::init()->headers(true))
    )
    ->build();