Mindbody Sync Requirements
Purpose:
This app is being created to upgrade from our original VB.net app (https://github.com/Text-Connects/UDF_Manage) and we need to provide the same functionality + new functionality.
Requirements:
- Ability to validate users from the mobile apps
- Ability to setup / configure videos for the ON DEMAND system
- Ability to setup / configure all notifications in the system + send as needed
- Ability to track users from MB into our App and back
info
Developer Account for Mindbody - MindBody Developer Account (in Passportal)
DO NOT CREATE A NEW DEVELOPER ACCOUNT!
danger
Current beta version will utilize SANDBOX instance ONLY
MB = Mindbody
Error Codes = See / Update the ERROR CODES tab in Gitbooks as you add errors
Sandbox Access
https://developers.mindbodyonline.com/ui/documentation/public-api#/http/mindbody-public-api-v6-0/introduction/using-the-sandbox Sandbox Documentation
To access the sandbox, use the following steps:
- Go to the MindBody Client Launch site
- Type in your Site ID or site name into the search bar and click search. The Site ID can be found in Passportal under MindBody Sandbox Access.
- Select the API Sandbox Site. This should take you to a login page.
- Type in the email/username and password. These can also be found in Passportal under MindBody Sandbox Access.
- Click login. This will take you to the sandbox site's dashboard and you may explore from there. The image below is the site you should be taken to.

Development Setup - API Authentication
Utilizing the SANDBOX, enable the authentication and build a simple node function you can call that injects all the required header items into your fetch.
API_KEY = ENV Value
AUTHORIZATION = ENV VALUE
SiteID = ENV VALUE
App Name = 'THE U MOBILE APP'
ENV Initial Setup
MB_API_KEY=1234
MB_AUTHORIZATION=1234
MB_SITE_ID=1234
MB_APP_NAME="THE U MOBILE APP"
https://developers.mindbodyonline.com/ui/documentation/public-api#/http/mindbody-public-api-v6-0/authentication/api-keys API AUTHENICATION
After gaining access to the API, you will then need to build a function that can return a staff (user) token, these tokens are required to actually work with the API in MB. They should be easily generated using a function that any part of the app can call
https://developers.mindbodyonline.com/ui/documentation/public-api#/http/api-endpoints/user-token/issue-token
Express Endpoints for dev - (testing endpoints)
GET /dev/validate-auth
Response
title="200"
{
"TokenType": "TokenType2",
"AccessToken": "12345", (ONLY SHOW THE LAST 4 DIGITS)
"Expires": "2016-03-13T12:52:32.123Z",
"User": {
"Id": 116,
"FirstName": "FirstName8",
"LastName": "LastName2",
"Type": "Type6"
}
}
title="500"
{
"error": "MB ERROR MESSAGE HERE"
}
QA Requirements
- Access the
/dev/validate-authendpoint and get back a 200 response. - Change the ENV so that you have an invalid login, then try
/dev/validate-authagain and you should get a 500 error with the message associated
Requirement 1 - Client Details
To manage Mindbody Client data, we must download a list of all clients in the MINDBODY system.
The MB Client data set is used in the app to manage authentication and validation of client access rights to the Video On Demand System. We need to sync all data with our internal database.
Initial Database Layout
_id SEQUENCE (internal db id)
emailAddress varchar(255)
firstName varchar(255)
lastName varchar(255)
mbClientId varchar(255) - Mindbody Client ID
mbStatus varchar(50) - Mindbody Client Status String
lastAttendedClass timestamp
vodAccessLevel int4
Get Clients from MB
Data Sync Endpoint
GET /api/sync/clients
Calling this endpoint will kick off a client data sync, which will go to MB and find all clients, then download them into the database (update or insert depending on if they exist - use both the MB Client ID field and the email address fields as a way to find records to update).
Note - some clients may exist IN the database but not in MB to start due to the app authentication system and the possibility of a new "GUEST" user.
Response
title="200"
{
"clientsFound": 100, - Number Returned by Mindbody after going through all pages
"clientsStored": 100, - Number stored in database via update or insert
"pages": 4 - number of pages MindBody returned
}
title="500"
{
"error": "MB ERROR MESSAGE HERE"
}
QA Requirements
- Calling the
/api/sync/clientsendpoint will return the number of clients in the MB instance and the number of pages should equal the number of clients, divided by the number of clients per page (dev to note in asana description and below in GITBOOK) - Calling the
/api/sync/clientsendpoint with invalid credentials should generate the 500 error message
CLIENTS_PER_PAGE: ________
Requirement 2 : Contract Details
To maintain the status of clients, we must sync all the contract details for a specific client. There are two ways we will handle this
Method 1 - Scheduled Weekly Sync
Method 2 - On Demand Single Client Sync
Method 2 is used by the Customer Service team to update a Client that may have lost access to VOD Premium or new clients that are missed with the new sync. Method 2 can also be called by our system on LOGIN if a customer does not have a MB ID in the database, letting us run a one time system update for that customer
Weekly Sync - Manually Call Function
GET /api/sync/contracts
Syncing contracts with clients to store in the database
Response
title="200"
{
"clientsSynced": 100, - Number of clients that have their contract data synced
"clientsNotSynced": 100, - Number of clients without any contract details
"errors": [] - array of any errors during processing
}
title="500"
{
"error": "MB ERROR MESSAGE HERE"
}
On Demand Single Client Sync
GET /api/sync/contracts/:mbClientId
Syncs with dataset and validates 1 client on demand.
Note, this endpoint will be updated to include authenication from the app layer to call and run from the UI.
Example of current call used by client - https://udf-server.txtcon.io/validateContracts.aspx?mbid=100003381
Response
title="200"
{
"vodAccessLevel": 1, - Access Level as determined by system
"vodAccess": true, - If any access to VOD provided, show TRUE - will be used for UI
"mbContracts" : [], - array of all MB Contracts
"errors": [] - array of any errors during processing
}
title="404"
{
"notFound": true
}
title="500"
{
"error": "MB ERROR MESSAGE HERE"
}
QA Requirements
- Ability to call the Method 1 endpoint and see that the system is updating items
- Abilty to call Method 2 with a predefined MB ID for Allowed VOD and one that is NOT allowed (dev to add to ASANA task)
- When changing access tokens, the system should show an error
- When changing the MB ID to 100000, it should throw a NOT FOUND user error
FUTURE DETAILS BELOW
VOD Access Level Database
id SEQUENCE (internal db id)
vodAccessLevelName varchar(255)