Examples of how to use type 5 + type 3 integration with your application
Examples of how to use type 5 + type 3 integration with your application
Before you go through this article make sure you have familiarize yourself with the spintly type 5 and spintly type 3 apis, if you have not please visit the following two links
- In depth explanation of all the apis spintly provides with type3 - click here to visit the page
- In depth explanation of all the apis spintly provides with type3 - click here to visit the page
Example
Normaly any access control company or any saas software always have two softwares
- Account creation software(internal): This tool is normally used by the internal people to create an account for a customer who has paid for the software. This tool creates an account for the customer and setups and configures the account based on the plan the customer has selected
- The main software: This software will be used by the customer to solve certain problem which the software is offering
Account creation software may look something like this(used by the sales or internal support person of the saas company)
The main software used my customer may look something like this
And the tables which are used
Company table
id | name | status | totalUsers |
1 | Acme | Active | 50 |
2 | SpaceY | Inactive | 30 |
3 | elloit | Active | 70 |
Locations table
id | name |
1 | Mumbai |
2 | Dubai |
3 | New York |
Now you get a requirement from your management that the software needs to be integrated.Below is a short guide on how to integrate with spintly. So lets start from the account create software
Below are the few changes which we would like you do in the websites as well as backend
In Add new customer form add a button to enable spintly or disable spintly
Th tables following changes we will need you to do
Company table
id | name | status | totalUsers | spintlyOrgId |
1 | Acme | Active | 50 | 12 |
2 | SpaceY | Inactive | 30 | 14 |
3 | elloit | Active | 70 | 16 |
Locations table
id | name | spintlySiteId |
1 | Mumbai | 1001 |
2 | Dubai | 1002 |
3 | New York | 1003 |
SpintlyBackendDetails table
spintlyBackendClientid | spintlyBackendClientSecret | spintlyAccessToken | spintlyrefreshToken |
a21a2cca-1220-4619-93f1-e26708dde8f0 | 0c444884-c697-4d36-9dc4-81a97c53d56c |
Add new customer
So here when the admin clicks on save, the above details will be sent to the client backend
Company table
id | name | status | totalUsers | spintlyOrgId |
1 | Acme | Active | 50 | 12 |
2 | SpaceY | Inactive | 30 | 14 |
3 | elloit | Active | 70 | 16 |
4 | JBM | Intializing | 0 |
Locations table
id | companyId | name | spintlySiteId |
1 | 1 | Mumbai | 1001 |
2 | 2 | Dubai | 1002 |
3 | 3 | New York | 1003 |
4 | 4 | Delhi |
As seen above the new entries will be created in company table and locations table, once the enrty is inserted you will have to call spintly create organisations api, integratorId, partnerId will be provided by spintly, you can put it in your env file
When you send the above request you will get the following response
The above organisationId value can be put for spintlyOrgId in the company table
Company table
id | name | status | totalUsers | spintlyOrgId |
1 | Acme | Active | 50 | 12 |
2 | SpaceY | Inactive | 30 | 14 |
3 | elloit | Active | 70 | 16 |
4 | JBM | Intializing | 0 | 659 |
And the site id value you can put for spintlySiteId in locations table
Locations table
id | companyId | name | spintlySiteId |
1 | 1 | Mumbai | 1001 |
2 | 2 | Dubai | 1002 |
3 | 3 | New York | 1003 |
4 | 4 | Delhi | 830 |
The same company created above can be seen in spintly partner portal also like below, once the account is setup in spintly also, the spintly deployment team can add and configure the door under each customer
Once the access points and doors are added, the The main software can be used.
To know how the main software works please refer this link