A module for using the tesla streamin API
npm install teslastreaming
This module is used to connect to and listen on the Tesla streaming API, exposed via WebSocket. The API is a convenience method in extension of the regular REST API (
This module is UNOFFICIAL.
In order to use the streaming API, you need to obtain an access_token via the auth REST API.
Add this module to your project using
$ npm i teslastreaming
The following example stores a log of messages into an array, a very basic logger if you will:
``typescript
import { teslaAPI } from "./index";
const vehicleId = '
const token = '
const messages = [];
teslaAPI(vehicleId, token).subscribe((event)=> {
messages.push(event);
console.log(messages received: ${messages.length});Tesla says: ${JSON.stringify(event, null, 2)}
console.log()``
});