#
The ConnectedCar JavaScript SDK is an open-source, python package that provides the ability to send commands to your Ford Sync Connect (Ford Pass) connected vehicle.
npm install connected-car
Requirements
Import the ConnectedCar SDK
import connectedcar from 'connected-car';
Create a new connectedcar client
9fb503e0-715b-47e8-adfd-ad4b7770f73b
const client = connectedcar.AuthClient('9fb503e0-715b-47e8-adfd-ad4b7770f73b', {region: 'US'}); // Region argument is only required if you live outside the United States.
Use client.getAccessTokenFromCredentials()
to exchange your user credentials for an token
object. To make any vehicle data request to the Ford Sync Connect API, you'll need to give the SDK
a valid access token.
const token = await client.getAccessTokenFromCredentials({
username: '<username>',
password: '<password>',
});
Access tokens will expire every 2 hours, so you'll need to constantly refresh them by calling
client.getAccessTokenFromRefreshToken()
const refreshToken = await client.getAccessTokenFromRefreshToken(token.getRefreshToken());
With your access token in hand, use connectedcar.User()
to get a User object representing the
user.
const user = connectedcar.User(token.getValue());
Use user.vehicles()
to return an array of all the vehicles associated with a users account. The
response will include the vehicle vin.
const vehicles = await user.vehicles();
const vehicleList = []; // Array of vehicles
for (userVehicle of vehicles) // For each user vehicle
vehicleList.push(userVehicle['VIN']);
Now with a vehicle vin in hand, use connectedcar.Vehicle()
to get a Vehicle object
representing the user's vehicle.
let currentVehicle = connectedcar.Vehicle(vehicleList[0], token.getValue());
Now you can ask the car to do things, or ask it for some data! For example:
await currentVehicle.start();
For more examples on what you can do with your ConnectedCar, see the examples folder or take a peek at the documentation.
If you are interested in supporting the development of my projects check out my patreon or buy me a coffee.
THIS CODEBASE IS NOT ENDORSED, AFFILIATED, OR ASSOCIATED WITH FORD, FOMOCO OR THE FORD MOTOR COMPANY.