Socket
Book a DemoInstallSign in
Socket

so-teams-sdk

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

so-teams-sdk

SDK for Stack Overflow Teams API

latest
npmnpm
Version
1.2.0
Version published
Weekly downloads
11
175%
Maintainers
1
Weekly downloads
 
Created
Source

Stack Overflow for Teams SDK

A comprehensive TypeScript/JavaScript SDK for interacting with the Stack Overflow for Teams API. This toolkit provides easy-to-use methods for accessing questions, answers, users, and other resources in your Stack Overflow for Teams instance.

Features

  • 🚀 Simple API wrapper - Clean, intuitive interface for all Stack Overflow for Teams endpoints
  • 🔒 OAuth2 authentication - Built-in support for access token authentication
  • 📦 Modular design - Organized client modules for different resource types
  • 🎯 Team context support - Switch between different teams seamlessly
  • 📝 Full TypeScript support - Complete type definitions for all API responses
  • 🔄 Future-proof - Always up-to-date with the latest API specification

Installation

npm install stack-overflow-teams-sdk
yarn add stack-overflow-teams-sdk

Quick Start

Basic Setup

import { StackOverflowSDK } from 'so-teams-sdk';

const sdk = new StackOverflowSDK({
  accessToken: 'your-oauth2-access-token',
  baseUrl: 'https://[your-site].stackenterprise.co/api/v3'
});

Working with Questions

// Get all questions
const questions = await sdk.questions.getAll();

// Get a specific question
const question = await sdk.questions.get('question-id');

// Search questions
const searchResults = await sdk.search.search({
  query: 'typescript',
  tags: ['javascript', 'node.js']
});

Working with Answers

// Get answers for a question
const answers = await sdk.answers.getAll('question-id');

// Get a specific answer
const answer = await sdk.answers.get('answer-id');

Team Context

For team scenarios, you can create team-specific contexts:

const teamContext = sdk.forTeam('team-id');

// Now all operations are scoped to this team
const teamQuestions = await teamContext.questions.getAll();

Available Clients

The SDK provides dedicated clients for each resource type:

ClientDescriptionExample Usage
answersAnswer operationssdk.answers.get(id)
questionsQuestion operationssdk.questions.getAll()
articlesArticle/documentationsdk.articles.getAll()
collectionsQuestion collectionssdk.collections.getAll()
commentsComments on postssdk.comments.getAll()
usersUser managementsdk.users.getAll()
tagsTag operationssdk.tags.getAll()
searchSearch functionalitysdk.search.query()
usergroupsUser group managementsdk.usergroups.getAll()
communitiesCommunity operationssdk.communities.getAll()

Configuration

SDKConfig Interface

interface SDKConfig {
  accessToken: string;  // OAuth2 access token
  baseUrl: string;      // API base URL
}

Authentication

Basic and Business customers can follow the official Stack Overflow for Teams guide to create a Personal Access Token (PAT) for API authentication:

👉 Personal Access Tokens (PATs) for API Authentication

Enterprise users can follow:

👉 Secure API Token Generation with OAuth and PKCE

const sdk = new StackOverflowSDK({
  accessToken: process.env.SO_TEAMS_ACCESS_TOKEN,
  baseUrl: 'https://[your-site].stackenterprise.co/api/v3'
});

Error Handling

try {
  const question = await sdk.questions.get('invalid-id');
} catch (error) {
  if (error.status === 404) {
    console.log('Question not found');
  } else {
    console.error('API Error:', error.message);
  }
}

Pagination

Many API endpoints support pagination:

const questions = await sdk.questions.getAll({
  page: 1,
  pageSize: 50,
  sort: 'creation',
  order: 'desc'
});

console.log(`Total questions: ${questions.total}`);
console.log(`Current page: ${questions.page}`);
console.log(`Total Pages: ${questions.totalPages}`);

API Reference

For detailed API documentation, please refer to:

  • https://[your-site].stackenterprise.co/api/v3
  • Generated TypeScript definitions in your IDE

Support

  • 🐛 Report issues on GitHub

Keywords

stackoverflow

FAQs

Package last updated on 16 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts