Client Side Flow
All the endpoints consumed in this page can be found here »
1. Getting needed config values
To get started you need a couple of endpoints to different parts of Fast Track integration. You also need a pusher key. All this will be returned from the config endpoint.
2. Log in to Fast Track integration
When you have the config object from previous request and also the current users sid and lastly, a brand name you can continue. Now you want to login to Fast Track using the sid. That will be done against authentication endpoint.
3. Connect to Pusher
On success, the LoginAuthToken endpoint will return a user object which contains values for setting up pusher. Pusher will authenticate with an endpoint in Fast Tracks backend. When you are authenticated to pusher you can bind upon which events you want to listen to. Currently Fast Track CRM supports three push notification "event types":
When you have bound the events to your functions populating the front end on messages you are done with the push notifications web socket part.
When using pusher on the client side you can either load pusher with a html script tag or via npm. Read more here about Pusher js. Pusher also has other libraries if you want to use pusher for your mobile app. Pusher docs
4. Getting existing messages
But there is more! What if the push notification was sent to the user when the user wasn't logged in? There is an endpoint for listing all existing messages a user has. Look in the API Endpoint Section at "Get All Notifications".
5. Marking messages
If you want to distinguish messages received / read by the user you can mark a notification as read using the following endpoint. When received the notifications from the endpoints above next time, the notification will be marked as read and you can take care of that in your JS / front end.
Have a look at "Mark Notification As Read" endpoint.
The full flow
Please let us know if you have any further questions!
Happy coding! 🚀