---
description: >-
  carter-js provides a robust and intuitive set of tools for integrating your
  nodeJS projects with CarterAPI.
---

# carter-js

## Prerequisites

In order to use `carter-js` you'll need to sign up to sign up to [CarterAPI](https://www.carterapi.com/) and create an agent. CarterAPI has excellent documentation.

## Installation

_`` `npm install carter-js` ``_

## The Carter Object

The main component of `carter-js` is the `Carter` object. This object provides a set of methods to interact with your carter agent, create useful skills, track the conversation history and analyse your agent's response times.

```javascript
import Carter from 'carter-js'

const carter = new Carter(apiKey, userLogger, speak) // Only API key is mandatory
```

It is important to remember to use the `new` keyword in order to create an instance of the Carter object. Pass in the apiKey of your specific agent - remember to keep this secret while developing and in production as this will allow anyone access to your agent.

You can also pass in a logger object. This feature is in beta and is untested, but provided the logger as debug, info, warn and error functions attached, it will log interactions with your carter agent to the relevant log levels.

### Speak

Carter's audio URL can cause some latency, and can therefore be toggled at a Class and Function level. Passing the `speak` boolean will set the default behaviour of your object. This will be used when calling any functions on the object, unless otherwise specified in the function call.
