Firebase Cloud Functions for HyperTrack Ridesharing sample app
Firebase Cloud Functions require a paid account to make outbound API calls. This includes API calls to HyperTrack APIs. We recommend using the Blaze plan. It gives a lot of bandwidth for free, which is more then enough to internally test the app.
Add to your project
- Clone the repo.
git clone https://github.com/hypertrack/ridesharing-firebase.git cd ridesharing-firebase
- Install Firebase tools CLI
npm install -g firebase-tools
- Login to your account and choose your project
firebase login firebase use --add
Select the project from dropdown menu. You can use any alias for the project.
- Install function dependencies
cd functions ; npm install ; cd ..
- Configure functions with HyperTrack API Keys
- Deploy functions into your Firebase Ridesharing project
firebase deploy --only functions
- Setup webhooks from HyperTrack to Cloud Functions
- Open the Functions > Dashboard tab in your Firebase project
- Copy the trigger URL for
- Go to HyperTrack's dashboard setup page and add this URL as a webhook URL.
- Go back to Firebase and open the Logs tab. Search for
onTripUpdatefunction's log with
SubscriptionConfirmationmessage. Open the
SubscribeURLin browser (XML file will appear). The webhook activation can take a few minutes. Refresh the dashboard's setup page to make sure, that activation was successful.
- Your Cloud Functions backend is now ready to interface with HyperTrack APIs.
For detailed documentation of the APIs, customizations and what all you can build using HyperTrack, please visit the official docs.
Frequently Asked Questions
No project active
No project active. Run with --project <projectId> or define an alias by running firebase use --add
This error while deploying functions means that you need to select the project first. Run
firebase use --add and select your project from dropdown menu, then add any alias to the project.
Error parsing triggers: Cannot find module 'moment'
This error can happen when your didn't run
npm install from the
functions directory. Run
cd functions ; npm install ; cd .. from the projects directory or execute the commands one by one:
cd functions npm install cd ..
We are excited to see what live location feature you build in your app using this project. Do ping us at firstname.lastname@example.org once you build one, and we would love to feature your app on our blog!