Accounts

SocFlow에 연동된 소셜 미디어 계정을 조회할 수 있습니다. 이 엔드포인트를 통해 Instagram, Facebook, Twitter 등 연동된 모든 계정 정보를 확인할 수 있습니다.

소셜 계정 정보에는 플랫폼 정보, 외부 계정 ID, 사용자 이름, 프로필 이미지 등이 포함됩니다. 이 정보는 게시물 작성 시 필요한 account_id를 얻는 데 사용됩니다.


GET/v1/accounts/social

소셜 계정 목록 조회

이 엔드포인트는 현재 사용자가 SocFlow에 연동한 모든 소셜 미디어 계정을 조회합니다. 각 계정은 고유한 ID를 가지며, 이 ID는 게시물 작성 시 사용됩니다.

인증

이 엔드포인트는 인증이 필요합니다. API 키를 X-Secret-Token 헤더에 포함해야 합니다.

요청

GET
/v1/accounts/social
curl --location 'https://api.socflow.app/api/v1/accounts/social' \
--header 'X-Secret-Token: {YOUR_API_KEY}'

응답

200
OK
{
  "success": true,
  "data": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "created_at": 1703001234567,
      "external_account_id": "17841400000000000",
      "external_username": "socflow_user",
      "external_name": "SocFlow User",
      "external_bio": "Social media automation made easy",
      "external_profile_url": "https://scontent.cdninstagram.com/v/...",
      "metadata": null,
      "social_provider": {
        "id": 2,
        "name": "instagram",
        "display_name": "Instagram",
        "kr_name": "인스타그램",
        "config": "{\"api_version\": \"v18\", \"rate_limit\": 200}",
        "icon_url": "https://www.instagram.com/static/images/ico/favicon.ico"
      }
    },
    {
      "id": "660e9511-f39c-52e5-b827-557766551111",
      "created_at": 1703001234890,
      "external_account_id": "987654321",
      "external_username": "socflow_threads",
      "external_name": "SocFlow Threads",
      "external_bio": "Connect with us on Threads",
      "external_profile_url": "https://scontent.cdninstagram.com/v/...",
      "metadata": null,
      "social_provider": {
        "id": 6,
        "name": "threads",
        "display_name": "Threads",
        "kr_name": "스레드",
        "config": null,
        "icon_url": "https://www.threads.net/favicon.ico"
      }
    }
  ]
}

응답 필드

Account 객체

  • Name
    id
    Type
    string
    Description

    소셜 계정의 고유 식별자 (UUID). 게시물 작성 시 이 ID를 사용합니다.

  • Name
    created_at
    Type
    number
    Description

    계정 연동 시각 (Unix timestamp, milliseconds).

  • Name
    external_account_id
    Type
    string
    Description

    외부 플랫폼에서 제공하는 계정 ID (예: Instagram Business Account ID).

  • Name
    external_username
    Type
    string
    Description

    외부 플랫폼의 사용자명 (예: @socflow_user).

  • Name
    external_name
    Type
    string
    Description

    외부 플랫폼의 표시 이름.

  • Name
    external_bio
    Type
    string
    Description

    외부 플랫폼의 프로필 소개글.

  • Name
    external_profile_url
    Type
    string
    Description

    외부 플랫폼의 프로필 이미지 URL.

  • Name
    metadata
    Type
    string | null
    Description

    추가 메타데이터 (JSON 문자열, 선택사항).

  • Name
    social_provider
    Type
    object
    Description

    소셜 플랫폼 정보 객체.

SocialProvider 객체

  • Name
    id
    Type
    number
    Description

    소셜 플랫폼의 고유 ID.

  • Name
    name
    Type
    string
    Description

    플랫폼의 내부 식별자 (예: instagram, facebook, twitter, threads).

  • Name
    display_name
    Type
    string
    Description

    플랫폼의 표시 이름 (예: Instagram, Facebook).

  • Name
    kr_name
    Type
    string | null
    Description

    플랫폼의 한국어 이름 (예: 인스타그램, 페이스북).

  • Name
    config
    Type
    string | null
    Description

    플랫폼 설정 정보 (JSON 문자열).

  • Name
    icon_url
    Type
    string | null
    Description

    플랫폼 아이콘 이미지 URL.


사용 예시

특정 플랫폼 계정만 필터링

const response = await fetch('https://api.socflow.app/api/v1/accounts/social', {
  headers: {
    'X-Secret-Token': process.env.SOCFLOW_API_KEY,
  },
})

const result = await response.json()

// Instagram 계정만 필터링
const instagramAccounts = result.data.filter(
  (account) => account.social_provider.name === 'instagram',
)

console.log('Instagram 계정:', instagramAccounts)

계정 선택 UI 구현

async function loadSocialAccounts() {
  const response = await fetch(
    'https://api.socflow.app/api/v1/accounts/social',
    {
      headers: {
        'X-Secret-Token': process.env.SOCFLOW_API_KEY,
      },
    },
  )

  const result = await response.json()

  if (!result.success) {
    console.error('계정 조회 실패:', result.errors)
    return
  }

  // 계정 목록을 UI에 표시
  result.data.forEach((account) => {
    console.log(`
      ${account.social_provider.display_name}: ${account.external_username}
      ID: ${account.id}
      프로필: ${account.external_name}
    `)
  })

  return result.data
}

// 사용 예시
const accounts = await loadSocialAccounts()
const selectedAccountId = accounts[0].id // 첫 번째 계정 선택

// 이제 이 ID로 게시물 작성 가능
console.log('선택한 계정 ID:', selectedAccountId)

자주 묻는 질문

  • Name
    Q: 계정 연동은 어떻게 하나요?
    Description

    A: 계정 연동은 SocFlow 웹 대시보드에서만 가능합니다. API를 통한 직접 연동은 지원하지 않습니다.

  • Name
    Q: 여러 Instagram 계정을 연동할 수 있나요?
    Description

    A: 네, 여러 Instagram Business 계정을 연동할 수 있습니다. 각 계정은 고유한 id를 가집니다.

  • Name
    Q: Personal Instagram 계정도 지원하나요?
    Description

    A: 아니요, Instagram Business 또는 Creator 계정만 지원합니다. Meta API 정책상 개인 계정은 API 접근이 제한됩니다.

  • Name
    Q: 계정 정보가 자동으로 업데이트되나요?
    Description

    A: 네, 소셜 플랫폼의 프로필 정보(이름, 사진 등)는 주기적으로 동기화됩니다.

Was this page helpful?