등록 정보
프리미엄, 음성 및 중복 디렉터리 등록 정보를 조회하고, 중복 등록 정보의 노출 차단을 관리하며, listingsapi-js SDK로 프로필을 연결합니다.
등록 정보는 개별 디렉터리(Google, Yelp, Bing, Alexa, Siri 등)에 표시되는 사업장 정보를 나타냅니다. 모든 등록 정보 메서드는 ListingsAPI 클라이언트 인스턴스에 있으며, 사업장 ID를 기준으로 범위가 지정됩니다. 숫자형 사업장 ID는 자동으로 인코딩되므로 16808과 'TG9jYXRpb246MTY4MDg='를 서로 바꿔 사용할 수 있습니다.
fetchPremiumListings
Google, Yelp, Facebook 및 나머지 핵심 디렉터리 네트워크에서 사업장의 프리미엄 디렉터리 등록 정보를 조회합니다. id, site, syncStatus, displayStatus, listingUrl 등의 필드가 포함된 Listing 객체 배열을 반환합니다.
const listings = await client.fetchPremiumListings(16808); for (const l of listings) {console.log(l.site, l.syncStatus, l.listingUrl);}가능한 syncStatus 값에는 SYNCED, PENDING, ERROR, NOT_CONNECTED가 있습니다.
fetchVoiceListings
Google Assistant, Amazon Alexa, Apple Siri 및 유사한 음성 비서의 등록 정보를 조회합니다. name, voiceIdentifier, syncStatus 등의 필드가 포함된 VoiceListing 객체 배열을 반환합니다.
const voice = await client.fetchVoiceListings(16808); console.log(voice.length + ' voice listings');for (const v of voice) {console.log(v.name, v.syncStatus);}fetchDuplicateListings
특정 사업장에서 감지된 중복 등록 정보를 조회합니다. id, site, listingUrl 등의 필드가 포함된 DuplicateListing 객체 배열을 반환합니다.
const duplicates = await client.fetchDuplicateListings(16808); for (const d of duplicates) {console.log(d.site, d.listingUrl);}fetchAllDuplicateListings
계정 내 모든 사업장의 중복 등록 정보를 집계하여 조회하며, 선택적으로 태그 필터링과 페이지 나누기를 적용할 수 있습니다. fetchDuplicateListings과 달리 단순 배열이 아닌 집계 객체를 반환합니다.
// All duplicates across the accountconst rollup = await client.fetchAllDuplicateListings(); // Filter by tag and pageconst page2 = await client.fetchAllDuplicateListings({ tag: 'region:west', page: 2 });옵션
markListingsAsDuplicate
사업장의 등록 정보 항목을 하나 이상 중복으로 표시합니다. 플랫폼은 표시된 프로필이 노출되지 않도록 처리를 시도합니다.
await client.markListingsAsDuplicate(16808, ['listing-item-id-1','listing-item-id-2',]);매개변수
확인할 성공 플래그는 없습니다. 플랫폼이 쓰기를 거부하면 클라이언트에서 ValidationError 예외가 발생하므로, Promise가 정상적으로 완료되면 성공한 것입니다.
markListingsAsNotDuplicate
잘못 표시된 등록 정보 항목의 중복 플래그를 해제합니다.
await client.markListingsAsNotDuplicate(16808, ['listing-item-id-1',]);매개변수
connectListing
사업장을 연결된 Google 또는 Facebook 계정의 등록 정보에 연결합니다. 계정을 연결하고 일치하는 등록 정보를 찾은 후 사용합니다.
await client.connectListing(16808,'connected-listing-id','connected-account-id',);매개변수
disconnectListing
사업장과 해당 Google 또는 Facebook 등록 정보 간의 연결을 해제합니다. 사이트 이름은 자동으로 대문자로 변환되므로 'google'과 'GOOGLE' 모두 사용할 수 있습니다.
await client.disconnectListing(16808, 'GOOGLE');매개변수
createGmbListing
연결된 Google 계정을 사용하여 기존 사업장의 Google Business Profile 등록 정보를 생성합니다.
const result = await client.createGmbListing(16808, 'connected-account-id'); // Optionally place the new listing in a specific folderawait client.createGmbListing(16808, 'connected-account-id', {folderId: 'folder-id',});매개변수
일반적인 점검 절차
import { ListingsAPI } from 'listingsapi-js'; const client = new ListingsAPI(); // reads LISTINGSAPI_KEY from envconst LOCATION_ID = 16808; // Acme Dental const [premium, duplicates] = await Promise.all([client.fetchPremiumListings(LOCATION_ID),client.fetchDuplicateListings(LOCATION_ID),]); const unsynced = premium.filter((l) => l.syncStatus !== 'SYNCED');console.log(unsynced.length + ' unsynced listings'); if (duplicates.length > 0) {const ids = duplicates .map((d) => d.id) .filter((id): id is string => Boolean(id));await client.markListingsAsDuplicate(LOCATION_ID, ids);console.log('Marked ' + ids.length + ' duplicates');}