Build with OmniConnect
A detailed guidance to building with OmniConnect SDK
Introduction
OmniConnect is the client-side component that your end-users will interact with in order to link their utility accounts to Omnimetic and allow you to access utility data via the Omnimetic API or Console.
OmniConnect will handle end to end account linking including credential validation and error handling for each suppported utility provider. OmniConnect works well with all the modern browsers and mobile platforms.
OmniConnect Flow
OmniConnect flow begins with launching of the OmniConnect interface in your application to connect utility accounts.
1. OmniConnect pass your secret key pairs to our servers and on successful validation, it return temporary access token which needed for API calls made from OmniConnect.
2. User select their utility provider and enter their account credentials securely for validation and on successful validation, our server return the list of associated service accounts.
3. OmniConnect allows user to select the service accounts they want to connect and pass to Omnimetic server.
4. On successful account connection, our server return the IDs of connected service accounts which your application should store and pass while calling utility data API for specific service account.
Integration Steps
Reference for integrating the OmniConnect in your web or mobile applications.
Installation
Include the OmniConnect initialize script in the page of your application where you want to load. It would always be loaded directly from our CDN, rather than included in a bundle or hosted yourself.
<body><script src="https://cdn.jsdelivr.net/gh/omnimetic/sdk/production/bundle.min.js"</script></body>
Create OmniConnect Container
Create a container (preferbly a div block) that OmniConnect can refer to load the SDK in your app UI.
<body><script src="https://cdn.jsdelivr.net/gh/omnimetic/sdk/production/bundle.min.js"</script><div id="omniconnect”></div></body>
Create OmniConnect Object
Create an OmniConnect object where you can pass the HTML container that OmniConnect can refer to and set of secret key and client ID generated through our Omnimetic Console.
<body><script src="https://cdn.jsdelivr.net/gh/omnimetic/sdk/production/bundle.min.js"</script><div id="omniconnect”></div><script></body>const container = document.getElementById("omniconnect");const omnimetic = new Omniconnect(container, {secret: <secret key> ,clientId: <client id>})
</script>
Initialize OmniConnect
Use OmniConnect object to initiate the SDK by calling open function.
omnimetic.open()
On successfuly calling the open function, it’ll return below mentioned promises -
Case 1: When the user successfully links their service account(s).
{message: "Resolved: User account(s) successfully linked",
serviceAccounts: "<account id and list of service account ids>",
status: "OM200"}
Case 2: When user closes the OmniConnect interface.
{message: "Rejected: User closes the widget",
status: "OM400"}
Case 3: When pair of client id and secret key provided to initiate the SDK are incorrect.
{message: "Rejected: Incorrect secret or client id",
status: "OM410"}
Case 4: When Omnimetic server is down.
{message: "Rejected: Internal server error",
status: "OM500"}
Troubleshooting
Since all your customers will go through OmniConnect to connect their accounts, it's important to build as robust an integration as possible. For details on dealing with common problems or assistance, feel free to reach out to us.