Skip to content

Configuration

Complete configuration guide for the BWS X SDK.

Environment Variables

Create a .env file:

bash
# Crawler Accounts
X_ACCOUNTS='[{"id":"account1","username":"@user1","cookies":{"auth_token":"...","ct0":"..."}}]'

# Twitter API
TWITTER_ACCOUNTS='[{"name":"main","bearerToken":"..."}]'

# SDK Options
SDK_OPTIONS='{"mode":"hybrid","preferredMode":"crawler"}'

# Proxy (optional)
PROXY_CONFIG='{"enabled":true,"provider":"oxylabs","username":"...","password":"..."}'

# Webhooks (optional)
WEBHOOK_CONFIG='{"enabled":true,"url":"https://...","secret":"..."}'

Programmatic Configuration

typescript
import { XTwitterClient } from '@blockchain-web-services/bws-x-sdk-node';

const client = new XTwitterClient({
  mode: 'hybrid',
  preferredMode: 'crawler',
  
  api: {
    accounts: [{
      name: 'main',
      bearerToken: process.env.TWITTER_BEARER_TOKEN
    }]
  },
  
  crawler: {
    accounts: [{
      id: 'account1',
      username: '@myaccount',
      cookies: {
        auth_token: process.env.AUTH_TOKEN,
        ct0: process.env.CT0
      }
    }]
  }
});

Configuration Options

See the API Reference for all available options.

Next Steps

Released under the MIT License.