# @yext/answers-core

> Typescript Networking Library for the Yext Answers API

Latest version **1.7.0** (published 2022-06-16) · BSD-3-Clause license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @yext/answers-core
pnpm add @yext/answers-core
yarn add @yext/answers-core
bun add @yext/answers-core
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.7.0 |
| Published | 2022-06-16 |
| First published | 2020-12-30 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=12 |
| Dependencies | 2 |
| Unpacked size | 1.2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | slapshot@yext.com |
| Maintainers | twhiteyext, ewu42, bryanreed, dlsgusrn7577, klu, paigep, stellali, petya182, ptroupgalligan, kowusumensah, aparnagh, syhanley, andyluu, zhengzhi, icapistrano_, mdavis-yext, jimboh, jballschneider, jknutsonn, jamesyang14, jfromm, tobyko, lymarrie, levyshi9945, mkilpatrick, baigel1, koyoldc, nricartsanchez, roser11, dkang3021, xlin97, mleifer, pmomesso, eefi, mxs2019, jaredhood, nmanu, jrhoads, npark, lki9419, mancusi, rchhatre, mtusman, mdavish, apavlick, yext_eng_npm, benmcginnis, kunal-p, data-enabler, tmeyer2115, mbowman, jronkin_yext, oshi, svc_jenkins_consulting_yext, cblair_yext, mpittinsky, jtufts, eercelebi, afitzgeraldyext, mwoon, alex_ginsberg, cxchen, willgorick, bhaines-yext, aliang_yext, inemzer, zgeier, sgresh_yext, rconsalo, stephenrva, jbaik, sjayakumar, tritpham, hoosred, ttimblin, sharvey, jameshu01, dwuyext, wenright-yext, npatel94, johnnguyen, zgu, telliottyext, johncho92, jpjamipark, tconnolly, canderson_yext, hgaertner, gweiler, ssaunders, sukim, rpope, eal172, peteros, jachen1997, jesuyed, ytruong, joshuahsueh |

## Links

- npm: https://www.npmjs.com/package/@yext/answers-core
- Repository: https://github.com/yext/answers-core
- Homepage: https://github.com/yext/answers-core#readme
- Issues: https://github.com/yext/answers-core/issues
- npm.io page: https://npm.io/package/@yext/answers-core

## Dependencies (2)

- [cross-fetch](https://npm.io/package/cross-fetch.md) ^3.1.5
- [@babel/runtime-corejs3](https://npm.io/package/@babel/runtime-corejs3.md) ^7.12.5

## Recent versions

- 1.7.0 (latest) — 2022-06-16
- 1.7.0-alpha.165 (alpha) — 2022-05-26
- 1.6.0-beta.7 (beta) — 2022-04-11
- 1.6.0 — 2022-05-10
- 1.6.0-beta.6 — 2022-03-23
- 1.6.0-beta.5 — 2022-03-17
- 1.6.0-beta.4 — 2022-03-15
- 1.5.2 — 2022-03-11
- 1.5.1 — 2022-03-10
- 1.6.0-beta.3 — 2022-03-02
- 1.6.0-beta.2 — 2022-02-02
- 1.6.0-beta.1 — 2022-02-01
- 1.6.0-beta.0 — 2022-01-18
- 1.5.0 — 2022-01-11
- 1.5.0-beta.1 — 2021-12-06
- … 28 more at https://npm.io/package/@yext/answers-core/versions

## README

# Answers Core


<div>
  <a href="https://npmjs.org/package/@yext/answers-core">
    <img src="https://img.shields.io/npm/v/@yext/answers-core" alt="NPM version"/>
  </a>
  <a href="./LICENSE">
    <img src="https://img.shields.io/badge/License-BSD%203--Clause-blue.svg" alt="License"/>
  </a>
  <a href='https://coveralls.io/github/yext/answers-core?branch=master'>
    <img src='https://coveralls.io/repos/github/yext/answers-core/badge.svg?branch=master' alt='Coverage Status' />
  </a>
</div>
<br>

Answers Core is a networking library for interacting with the Yext Answers API.

[Full Documentation](./docs/answers-core.md)

## Features

- Works in both the **browser** and **Node.js**
- 100% **TypeScript**, with detailed request and response models
- Compatible with both **CommonJS** and **ES6** imports
- Offers a ponyfilled ES5 bundle which doesn't pollute the global namespace

## Getting Started

For a full getting started walk through, view our [official Hitchhiker Guide](https://hitchhikers.yext.com/guides/answers-core-getting-started/).

First, install Answers-core via [npm](https://www.npmjs.com/get-npm):

```bash
npm install @yext/answers-core
```

Next, import and initialize the core library in your application.

The apiKey and experienceKey will come from your Answers experience on yext.com. You can signup for a free trial at [https://www.yext.com/free-trial/](https://www.yext.com/free-trial/).

```js
import { provideCore } from '@yext/answers-core';

const core = provideCore({
  apiKey: '<your api key>',
  experienceKey: '<one of your experience keys>',
  locale: 'en',
  experienceVersion: 'PRODUCTION',
});
```

To use the library with Node, use the following import instead:
```js
const { provideCore } = require('@yext/answers-core');
``` 

Now that the core is initialized, let's run a search on an "FAQs" vertical.

```js
core.verticalSearch({
  verticalKey: 'FAQs',
  query: 'What is Yext Answers?',
}).then(results => {
  // Do something with the search results
}).catch(err => {
  // Handle errors thrown by the core library
});
```

### Explanation of Builds
- The ESM (ES6) build will be used automatically by module bundlers that support it (e.g. Webpack). It can be specified directly by importing `@yext/answers-core/lib/esm`
- The CommonJS build will be used automatically by Node, but it can be specified directly by importing `@yext/answers-core/lib/commonjs`
- The Legacy (UMD) bundle should be used for supporting IE11 out of the box. It is compiled to ES5 and it contains the necessary ponyfills for IE11. If your application already contains polyfills, we recommend bundling one of the other builds in order to prevent your application from including duplicate polyfills. This bundle can be specified by importing `@yext/answers-core/legacy`


And that's it! See **[our documentation](./docs/answers-core.answerscore.md)** for a full list of supported API calls.

## License

Yext Answers-core is an open-sourced library licensed under the [BSD-3 License](./LICENSE).

## Third Party Licenses

The licenses of our 3rd party dependencies are collected here: [THIRD-PARTY-NOTICES](./THIRD-PARTY-NOTICES).

---
_Source: https://npm.io/package/@yext/answers-core · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
