# Digital Spine Integration Client Deployment Guide - from Azure marketplace

{% hint style="info" %}
The public Digital Spine Integration Client and associated message broker service is currently offered free of charge for Energy Web Member organizations and on a free trial basis for non-members. Please note that the message broker is rate-limited in the free version, and thus may not be suitable for high volume / high frequency data exchange use cases. For assistance in configuring a custom DSI Client and Message Broker solution for your organization, please fill out this [form](https://www.energyweb.org/book-a-demo/).&#x20;
{% endhint %}

{% hint style="info" %}
Things to know before you start:

* Each section of this guide is demonstrated in a short video clip and accompanied with step by step instructions.
* Integration and identity access management (IAM) for the DSI Client is performed with Energy Web's [self-sovereign identity](https://docs.energyweb.org/legacy-documentation/foundational-concepts/self-sovereign-identity-introduction) [technology stack](https://docs.energyweb.org/legacy-documentation/ew-dos-technology-components-2023/identity-and-access-management-iam) (i.e [DIDs and verifiable credentials](https://docs.energyweb.org/legacy-documentation/ew-dos-technology-components-2023/identity-and-access-management-iam/patterns)). To manage your DID you will need a [Digital Wallet](https://docs.energyweb.org/legacy-documentation/community-resources/using-the-energy-web-chain/ewc-wallets) and [Metamask](https://docs.energyweb.org/legacy-documentation/ew-dos-technology-components-2023/trust-layer-energy-web-chain/ewc-guides-and-tutorials/connect-to-energy-web-chain-main-network-with-metamash), with a minimum balance of 0.1 EWT, to execute IAM transactions in the Switchboard application including requesting roles and publishing credentials to your DID document. You can read more about  [Switchboard and IAM processes here](https://docs.energyweb.org/legacy-documentation/ew-dos-technology-components-2023/identity-and-access-management-iam/iam-guides/using-switchboard).&#x20;
  * **NOTE**: Sending and receiving messages via the DSI Client Gateway does not directly use or interact with the Energy Web Chain; you do **NOT** need EWT to send and receive messages. EWT is required only for the IAM and enrollment processes.&#x20;
* You need an active [Azure](https://azure.microsoft.com/en-us) subscription to access the [DSI Client via the Azure marketplace](https://azuremarketplace.microsoft.com/en-us/marketplace/apps/energywebdevhubgmbh1670375546257.ewf-data-exchange-client-gateway). Additional cloud providers and self-hosted options will be available later in 2023.&#x20;
* You will need access to one of the following Secret Engines, with full Read & Write privileges required:

&#x20;           \- Azure KeyVault (Vault URI, Service principle’s appId, password, tenantid)

&#x20;           \- Hashicorp Vault (Vault URI, access token)
{% endhint %}

### Contents

1. ### [Prerequisite Check](#1.-prerequisite-check)&#x20;
   1. #### [**Configure MetaMask settings**](#1.1.-configure-metamask-settings)
   2. #### [**Secret Engine credentials**](#1.2.-secret-engine-credentials)
2. ### [Resource Provisioning](#2.-resource-provisioning.)&#x20;
   1. #### [Launching Digital Spine Integration Client instance](#2.1-launching-digital-spine-integration-client-instance)
   2. #### [Config DSI Client](#2.2-config-dsi-client.)
3. ### [Client UI walk through](#3.-client-ui-walk-through.)
4. ### [Creating Channels](#4.-creating-channels.)
   1. [**Creating a Publish Channel**](#4.1-creating-a-publish-channel)
   2. #### [**Creating a Subscribe Channel**](#4.2-creating-a-subscribe-channel)
5. ### [Demo Integration - test Sending / Receiving data](#5.-demo-integration-test-sending-receiving-data.)
   1. #### [**Example Post data to a Channel**](#5.1-example-post-data-to-a-channel)
6. ### [Conclusion](#6.-conclusion)

### 1. Prerequisite Check

#### **1.1. Configure MetaMask settings**

To integrate the DSI Client with the Energy Web-hosted message broker, you will need to acquire and manage roles on Switchboard (<https://switchboard.energyweb.org/>). [Metamask](https://docs.energyweb.org/legacy-documentation/ew-dos-technology-components-2023/trust-layer-energy-web-chain/ewc-guides-and-tutorials/connect-to-energy-web-chain-main-network-with-metamash) is used to log into the [Switchboard dApp](https://docs.energyweb.org/legacy-documentation/ew-dos-technology-components-2023/identity-and-access-management-iam/iam-guides/using-switchboard) and sign transactions.

{% hint style="info" %}
We recommend using Chrome (or Chromium-based, e.g. Brave) or Firefox desktop browsers to interact with the Switchboard dApp. To download MetaMask plugin to your browser, you can use the links below;

* Firefox:[ https://addons.mozilla.org/en-US/firefox/addon/ether-metamask/](https://addons.mozilla.org/en-US/firefox/addon/ether-metamask/)
* Chrome (or Chromium-based):[ https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn](https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn)
  {% endhint %}

Go to Settings > Networks and click Add Network button to add Energy Web Chain. Enter the details below to add Energy Web Chain as a new network.

| **Network Name**                                              |
| ------------------------------------------------------------- |
| Energy Web Chain                                              |
| **New RPC URL**                                               |
| [https://rpc.energyweb.org](https://volta-rpc.energyweb.org/) |
| **Chain ID**                                                  |
| 246                                                           |
| **Currency Symbol (optional)**                                |
| EWT                                                           |
| **Block Explorer URL (optional)**                             |
| <https://explorer.energyweb.org/>                             |

\
You can also use ChainList to quickly add Energy Web Chain as a new network to your MetaMask. To use this tool, please follow this[ link](https://chainlist.org/chain/246) and click “Add to MetaMask” button.

* Select Energy Web Chain from the dropdown (by default, the Ethereum Mainnet will be selected) before navigating to the Switchboard dApp homepage.

**1.1.a Funding Account**

The Switchboard dApp does require users to use [Energy Web Tokens (EWT)](https://docs.energyweb.org/legacy-documentation/ew-dos-technology-components-2023/trust-layer-energy-web-chain/energy-web-token) in order send transactions, sign messages or acquire credentials on the [Energy Web Chain](https://docs.energyweb.org/legacy-documentation/ew-dos-technology-components-2023/trust-layer-energy-web-chain/energy-web-chain-governance).&#x20;

*To learn how to acquire EWT in your wallet, click* [*here*](https://energy-web-foundation.gitbook.io/energy-web/ew-dos-technology-components-2023/trust-layer-energy-web-chain/energy-web-token)

#### **1.2. Secret Engine credentials**

**Azure KeyVault**

Suppose you have a role-based-access-control service principle (sp) created, which is granted full Read and Write permissions to the KeyVault, your sp details may look like

```json
{
 “appId”: “32xxx725-7xx9-46d1-b288-c552xxxxxab35",
 “displayName”: “vault-demo-sp”,
 “password”: “SLxxQ~2ul1J~4wxxNZ-o~sb65l4KuNhxxXaK9c4j”,
 “tenant”: “14e3fxx-fd1f-4exx9-a2aa-4a9xxxxxxx129"
}
```

You will need above details and the KeyVault uri on the resource creation page.

Learn more about

* [Azure Key Vault documentation](https://learn.microsoft.com/en-us/azure/key-vault/general/)&#x20;
* [Azure Service principle](https://learn.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal)

**Hashicorp Vault**

You just need

* vault server url
* The access token&#x20;

### 2. Resource Provisioning.

{% embed url="<https://www.youtube.com/embed/wSF6XggG8_g>" %}

#### 2.1 Launching Digital Spine Integration Client instance

Login to Azure portal and go to ‘Marketplace’ page.

On the marketplace page, search ‘energyweb’ in the search box as shown below:

<figure><img src="https://2400236058-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_pXALj14Egb-5Bal_p%2Fuploads%2FVD417edjPsVms4NLVWgc%2Fimage.png?alt=media&#x26;token=8fd03fa9-7be7-468a-9b84-edd0308194d7" alt=""><figcaption></figcaption></figure>

You will see the ‘Digital Spine Integration Client by EnergyWeb’ in the search results.

<figure><img src="https://lh6.googleusercontent.com/wiNwwtnjavxriBEe66R5nxL6rNoSpNj0lQdgRicgmidSsx7e0VHW39HO6Dx_aaml3f36omAWMKLn0oi4NCfAzznZNjWAOdfEGFD8BJ1YlAyQ7_Ce5o2pHvtn2KUGvtJIh5ZoGLbauIY2nGGqmXml_8Y" alt=""><figcaption><p>Digital spine integration client app</p></figcaption></figure>

Click ‘Create’ on the Offer tile. It will take you to the resource creation page.

Follow the user guide on the UI to fill in the required fields for ‘Basics’ and ‘Virtual Machine Settings’.

<figure><img src="https://2400236058-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_pXALj14Egb-5Bal_p%2Fuploads%2FJ0sEkln9LuTI2zQE5mur%2FScreen%20Shot%202023-06-30%20at%2010.19.23%20AM.png?alt=media&#x26;token=a9c3dd53-8cc2-40a2-a594-cc2de31bb044" alt=""><figcaption></figcaption></figure>

On the ‘Digital Spine Integration Client Settings’ tab, you can set the configuration for the DSI Client.

<figure><img src="https://2400236058-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_pXALj14Egb-5Bal_p%2Fuploads%2FdtMMBkMxXObuSQtysBlT%2FScreen%20Shot%202023-06-30%20at%2010.20.56%20AM.png?alt=media&#x26;token=cd1799d3-f517-46bf-9293-8821e59fabef" alt=""><figcaption></figcaption></figure>

Most configurations are pre populated, you just need to select the desired application to integrate with from the \`Application Name\` dropdown .

{% hint style="info" %}
There are 3 applications to choose from

* Global Data Exchange
* Greenproofs
* Open Charging Network

If you want to run any other applications, you need to make sure the application is available on the EWC chain. Or feel free to contact <digital-spine.support@energweb.org> for assistance (*responses are within 1-2 business days*)&#x20;

If you are an Energy Web member organization, you can also use the [Member Slack](https://ewf-affiliates.slack.com) channel #digital\_spine.
{% endhint %}

At the 'Vault Configuration' put in the secret engine details, below is the example for KeyVault.&#x20;

<figure><img src="https://2400236058-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_pXALj14Egb-5Bal_p%2Fuploads%2FiY2ea3Dce7WW6ff0gXRl%2FScreen%20Shot%202023-06-30%20at%2010.21.15%20AM.png?alt=media&#x26;token=c113756f-e188-41af-aabd-a48ef4cbbc2f" alt=""><figcaption></figcaption></figure>

{% hint style="danger" %}
The VM you are creating must have access to the chosen Secret Engine from a network perspective.
{% endhint %}

Once all the required fields have been filled. You can proceed to ‘Review + create’ tab, you can double check all the inputs. Then click ‘Create’ to start creating the resources.

After a couple of minutes, the resource creation will complete. You'll find a Virtual Machine under the resource group.&#x20;

On the VM’s overview page like below, the Digital Spine Integration Client can be accessed at the VM’s DNS in the browser.

<figure><img src="https://lh3.googleusercontent.com/4FLICFRHzzuVYw_WAL2cXtmM8OOmJvdU6UK0-tQJ_Xq7uDwxwcaThIDfyDhi7hOAtYA3uXRYFIOdP71_MzPR4E5iEazIUj65wBxu0eu1HXk-DlwODBf3tOIdgcSCMjKsYZ-yiDm7bCNe7z2D3ZaWTsI" alt=""><figcaption></figcaption></figure>

#### 2.2 Config DSI Client.

**2.2.a Visit Client Application**

{% embed url="<https://youtu.be/RF738wbFJIA>" %}
Access Instance
{% endembed %}

Open a browser and type in the DSI VM’s DNS; you will be directed to the DSI Client landing page as shown below: &#x20;

<figure><img src="https://lh4.googleusercontent.com/TspJ3HXYw27anRiSSwSuLdGVBOOE7rZWMkd51bM25PG4oW9uwB7hF24GZTREfW_4jvaQqXF4ReD7T17GVfbC7Sxak07DmI0Vb5oH50RyEPNISuaVgBg0j29KoqlgWI-3Jhn4WxMW89Pc98I4xTlTi-o" alt=""><figcaption></figcaption></figure>

**2.3 Configure DID on the DSI Client**

{% hint style="warning" %}
Reminder: Integration and identity access management (IAM) for the DSI Client is performed with Energy Web's [self-sovereign identity](https://docs.energyweb.org/legacy-documentation/foundational-concepts/self-sovereign-identity-introduction) [technology stack](https://docs.energyweb.org/legacy-documentation/ew-dos-technology-components-2023/identity-and-access-management-iam) (i.e [DIDs and verifiable credentials](https://docs.energyweb.org/legacy-documentation/ew-dos-technology-components-2023/identity-and-access-management-iam/patterns)). To manage your DID you will need a [Digital Wallet](https://docs.energyweb.org/legacy-documentation/community-resources/using-the-energy-web-chain/ewc-wallets) and [Metamask](https://docs.energyweb.org/legacy-documentation/ew-dos-technology-components-2023/trust-layer-energy-web-chain/ewc-guides-and-tutorials/connect-to-energy-web-chain-main-network-with-metamash), with a minimum balance of 0.1 EWT, to execute IAM transactions in the Switchboard application including requesting roles and publishing credentials to your DID document. You can read more about  [Switchboard and IAM processes here](https://docs.energyweb.org/legacy-documentation/ew-dos-technology-components-2023/identity-and-access-management-iam/iam-guides/using-switchboard).&#x20;

* **NOTE**: Sending and receiving messages via the DSI Client Gateway does not directly use or interact with the Energy Web Chain; you do **NOT** need EWT to send and receive messages. EWT is required only for the IAM and enrollment processes.&#x20;
  {% endhint %}

{% hint style="info" %}
You will need to acquire the role of 'user' on your DID in order to enroll your DSI Client to the public message broker. Please complete [this enrollment form](https://share.hsforms.com/17MEEj3poQWOKgGgVn9K7hw37vj2) for approval.&#x20;

**The DID will be the public address of the account you are using with your Digital Wallet and MetaMask.**&#x20;

The Energy Web team will review the enrollment request and grant approval within one business day of receipt.&#x20;
{% endhint %}

{% embed url="<https://youtu.be/hvWiHTDiUjU>" %}
Config DID on Client application
{% endembed %}

On DSI Client landing page, enter the private key for your DID you will use for enrollment (note: *the wallet address will be the DID*) and hit ‘Import’.

{% hint style="info" %}
To extract your private key for your Metamask account:

1. Click on the Account list dropdown, then click the kebab / three dot icon next to the account, then click 'Account Details'.&#x20;
2. That will display a QR code with the Account address, and a button to "Show private key"; click that button and enter your password when prompted to reveal the private key.&#x20;
3. Copy the private key and enter it into the form field in the DSI Client landing page.&#x20;
   {% endhint %}

{% hint style="warning" %}
Entering your private key at this step is a one-time configuration that is necessary to assign your DID to the DSI Client. When you enter the key in this step, it will be securely stored in the secret engine of your choice (i.e. Azure Key Vault or Hashicorp Vault). Energy Web **will not** have access to your key, and we will never ask you for it.&#x20;

**Be careful to never reveal, share, or paste your private key in any other steps within the DSI configuration and enrollment process.**&#x20;
{% endhint %}

<figure><img src="https://lh4.googleusercontent.com/TspJ3HXYw27anRiSSwSuLdGVBOOE7rZWMkd51bM25PG4oW9uwB7hF24GZTREfW_4jvaQqXF4ReD7T17GVfbC7Sxak07DmI0Vb5oH50RyEPNISuaVgBg0j29KoqlgWI-3Jhn4WxMW89Pc98I4xTlTi-o" alt=""><figcaption></figcaption></figure>

It can take up to a minute for the DID to be verified and configured (assuming that your DID already has the role 'user'; if not, complete the [enrollment form here](https://share.hsforms.com/17MEEj3poQWOKgGgVn9K7hw37vj2)).

If your wallet does not have sufficient balance (a minimum of 0.1 EWT is recommended) you may receive an ‘insufficient fund’ error message. *To learn about transactions and transactions costs, click* [*here*](https://docs.energyweb.org/legacy-documentation/foundational-concepts/ethereum/transaction-costs)*; to learn how to acquire EWT in your wallet, click* [*here*](https://energy-web-foundation.gitbook.io/energy-web/ew-dos-technology-components-2023/trust-layer-energy-web-chain/energy-web-token)*.*&#x20;

<figure><img src="https://lh6.googleusercontent.com/gQ1npdJy9fiLjn3TVQT6_3xrqxDbmKIn-61i-10VqGjvpdhZfPDRejVO5KlLSNLwdYSe-f6qI2zS0pjUHjHDTiK15aCN1TEXR13IeJ7Xi9jmcj-CI8jdrzIODdS3QeVHUDqMxdYsAzKYdTEambUJmqM" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
You'll need to have a sufficient balance of EWT in your wallet to pay for gas fees associated with DID enrollment transactions in order to proceed; a minimum balance of 0.1 EWT is recommended. **REMINDER**: You will only need to pay transaction costs for the IAM and enrollment processes.&#x20;
{% endhint %}

Once you have a sufficient balance of EWT to cover the transaction cost, the application will proceed to the next stage of access validation.&#x20;

**2.4 Enroll the DSI Client with DID**

{% embed url="<https://youtu.be/ah9R5TSNzKo>" %}
Access enrolment
{% endembed %}

If your DID doesn't have the required 'user' role to the application you selected for the Integration Client at [resource creation step](#2.-resource-provisioning.). You'll see an ‘Unauthorized’ error.&#x20;

<figure><img src="https://lh5.googleusercontent.com/KCreFvTBuZ7FGtgJCNuCtePdfVRGDsqCxjgBcgRXPORDk1atiqW2tcsyvEYKCIthAYmZawQ4BwBMcdsptf8uHMoFtDjbVqXZaXBfAR0SHCphF4y-fHrse3wdlr8hDNn0JiqN6is3oRWRAhRdALu_m3M" alt=""><figcaption></figcaption></figure>

To proceed, click ‘Enroll’ to submit the enrollment request.

<figure><img src="https://lh5.googleusercontent.com/YtVNcNBdNziweft9QIiBqk7Q5puyIOlIIfIqHbL5F9sCzb7514f-8rM22rnMWlOzFGAVgYQj8YyTFkccnOrgWjJv6yEwWq2-TML7Tbc_oHVTYy1brYuzC1PjhipoBY8xxi2YHHWoDdoUgcm2oKRVH7M" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
&#x20;Please complete [this enrollment form](https://share.hsforms.com/17MEEj3poQWOKgGgVn9K7hw37vj2) for approval.&#x20;

The Energy Web team will review the enrollment request and grant approval within one business day of receipt.&#x20;
{% endhint %}

When the user role for your selected application is approved, you will see the status is changed to ‘waiting for role to sync’.

<figure><img src="https://lh4.googleusercontent.com/OgEJ5djC-CiyOzkyt33nVOjygxn6WHJHhZaG316LMRlzqQYLvQ4fXrsRrBnu3gy4e_ZYCdjZK2lqkCM8NW_EZzSd_r3xIMqUNRYIpwKSfwm02N2AkRGf2_XPdTsKdj1mklKmT0_W2jFrTqnkIh5B67g" alt=""><figcaption></figcaption></figure>

**2.5 Manually sync role on Switchboard (dApp)**

{% embed url="<https://youtu.be/s2gMIIftZbU>" %}
Sync enrolment on Switchboard
{% endembed %}

After submitting the enrollment request for your DID, the Energy Web team will contact you via email to notify you of approval. Upon receipt of the approval email, you can publish the newly issued role(s) to your DID document by following the instructions below.&#x20;

{% hint style="info" %}
In this guide, we use Metamask, it is the same process for other wallet option to logon dApp Switchboard. Make sure you have [Metamask configured](#1.1.-configure-metamask-settings).
{% endhint %}

In a new browser tab, visit Switchboard (<https://switchboard.energyweb.org/>), click on the Use MetaMask button on the welcome screen of the Switchboard dApp to log in.

<figure><img src="https://lh6.googleusercontent.com/ug55gEBxBVah0dC0HZj5O8hmqzUKypPBL-rAF1eBrUV6V_N_N_wWL66xXnHpo-iUMAovB5jvE43TBFYgw7eAk_UpLF4dSvEJ3LtFopGJ8nrYoqjuvfE8rMNeTIYWNiXl6ARFm3DE5RXGnAzs2oaNjLo" alt=""><figcaption></figcaption></figure>

The MetaMask plug-in will pop up in the top right corner of the browser and request a signature to log in.

* If you are logging in with a MetaMask account, you will be prompted to sign the message in the MetaMask Extension.
* If you are logging in with a hardware wallet account (via MetaMask), you will also be prompted to connect to your hardware wallet and sign the message on that device.

After providing the signature, you will be logged in into Switchboard dApp.

<figure><img src="https://lh6.googleusercontent.com/xq7p_Zsk_tlmPULB-BNmuzgqzSPIjV1XOjZlmNpvlvYI9kEOFJg0LJABHttMi597mYb8gJhcGBRm5mC42ZPAW7SnQ1t02ZdUXpJA026CE81ubX3repMhI7rwUJDttx-burKJexB2FjNL8EuhxN5kFkQ" alt=""><figcaption></figcaption></figure>

The top right menu icon has a notification. Click to open, you will find one publication available.&#x20;

<figure><img src="https://lh6.googleusercontent.com/EvDdFfcmhqK5Kq3qpWp6Ys4CQQCNzeTZXWC_GKmrqIx-gS1MFJLRgDpf02MIJItxIByRVWw4HOQ7oGS6kyJhho9cVZbDIHhtpguhKWp7WhAJkr0XFK6k4qC6-EAtrgs1aXXcbArBdRnM6YElhWBO0jA" alt=""><figcaption></figcaption></figure>

Click ‘publish’, on the confirmation modal click ‘CONFIRM’.

<figure><img src="https://lh5.googleusercontent.com/bEnUUpu0p7-KtQ39U4UF-UHBpPGDGBqg6FfyPO3Dwd3NJd1TzhU9q35X8lH8cYtrSPejIpGCZLcC1tyueiA2XxoCWTSz21SJwGuJZjGh2CHYtubqRmPbR0S3sa2Jj9hotnsg1HGL0sTkL7f8fpETrl4" alt=""><figcaption></figcaption></figure>

The MetaMask plug-in will pop up in the top right corner of the browser and request a signature for the transaction.&#x20;

<figure><img src="https://lh3.googleusercontent.com/zdNeoes-9MIVD71sf_mi3wZTjMZKm3bW3xGx5dkaYFpDC1pWdvfvFvKbu4rOCixq0aKJ59lnC7Zo2TWdL-1fpS8hoI74Zp5WywlDR-hmA_KB8RWFoV1K8l_if7241fwhM3kHOlp0lKyxrSSsDMAnCNk" alt=""><figcaption></figcaption></figure>

Follow along to sign the transaction in Metamask, then you'll see the ‘publish is successful ‘ notification.<br>

When the publish is completed, you can return to the the DSI Client browser tab.

### 3. Client UI walk through.

{% embed url="<https://youtu.be/RHcxOf8LwWc>" %}
Application Dashboard
{% endembed %}

{% hint style="success" %}
This guide is based on the application name ‘**marketplace.apps.energyweb.iam.ewc**’, It is the same concept and flow for your chosen application
{% endhint %}

At the time of revisiting the DSI Client, it should successfully redirect you to the dashboard page. If not, check to make sure your Metamask extension is connected to the correct (enrolled) account. If the correct account is active, you may need to refresh the DSI Client landing page and re-enter your private key as described in the previous [section](#2.2-config-dsi-client.).&#x20;

<figure><img src="https://lh5.googleusercontent.com/WZWsJjmeDAz0ED9GWZhoRUTSpzJP22GToz2QyRLONgJ67U9Tr7ns7DroD6xFzOAxInlHhJ6d0ASI6-j2fkJH-UC6g16YSe8wTMZQri9rP4ZWth75_F8IQqDOORsuKDPeKQuWAXlZ7m495kLaAJI51mg" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
You may see fewer items under the ‘Scheduler’ section at the first time you log in. Just wait a few moments and refresh the page, there should be more scheduled tasks shown, the time under the task names is when the task was recently completed&#x20;
{% endhint %}

When you can see ‘Application refresh’ and ‘Topic Refresh’ with ‘Success’ status, you can navigate to ‘Topic management’ OR ‘Channels’ > ‘My apps and topics’ from the left navigation menu.

<figure><img src="https://lh6.googleusercontent.com/4a5CA_eSuerBfOeGqJg73X31YyChYssJKwSKuJ2aGNPXJzeUuUEWcgCNfCx0In2Trmlh0OMXhDRQcmcEyY8V9ZxMqvC2t6JW9KpzK5QFY_TWev8EdO-jvEmSWMWN8qiYz-QIaCrKPZqqMlaIwC_3GPs" alt=""><figcaption></figcaption></figure>

Your application will be shown on the list. There is one sample topic created for the application (\*one is available *at the time of writing, but additional topics will be added over time. You may see more topics available for your application*).

If you click on the application, it will show you all the topics

<figure><img src="https://lh6.googleusercontent.com/zepzjtu2V4vzAT3OhAyzjNJ98S6TurA9OaxMPlwpF_p1kePIWCXI9CFyrGhzqvmy13DKJzng3PsjmDxR5V-XvCEupDOzdRDAdaNgDuiqKFiOeVsK8P3cNKvVUw3AX9yxWMb0lHhPaYBYoXVzXYB-6V8" alt=""><figcaption></figcaption></figure>

You can also view the topic by clicking on it

<figure><img src="https://lh6.googleusercontent.com/Niqoxvk1uyx4LGY05FjTL_NRLa52x0bImZo0lzv6H8zwOKYKlBVV3w7FOvRewPXUZyJcErwGtq-fiU1GxLbpd_80HTZNJr2p84tUU5gECDyPdcPC8I8Teep9lHO8xG26fxnLsq6deVtlHIgdBpIj8dc" alt=""><figcaption></figcaption></figure>

> Topic is a definition of the data schema. Which will be strictly validated during data exchanging.
>
> You can learn more about topics [here](https://energy-web-foundation.gitbook.io/energy-web/ew-dos-technology-components-2023/decentralized-data-hub-ddhub/ddhub-patterns/channels-and-topics)

Next we'll explain how to use the topic.

{% hint style="warning" %}
The DSI Client lets you easily create more sophisticated topics based on different business requirements.&#x20;

You will need the ‘topiccreator’ role to manage(create/update/delete) topic/schema within an application scope.&#x20;

Please contact <digital-spine.support@energweb.org> for ‘topiccreator’ role enrolment or other assistances.
{% endhint %}

### 4. Creating Channels.

{% embed url="<https://youtu.be/T0Y8zDGS-eg>" %}
Creating Channels
{% endembed %}

You can have a better understanding about Digital Spine channels [here](https://energy-web-foundation.gitbook.io/energy-web/ew-dos-technology-components-2023/decentralized-data-hub-ddhub/ddhub-patterns/channels-and-topics). Few summarised Key points to bear in mind.&#x20;

* "Publish" type channel is for sending data and "Subscribe" type channel is used for retrieving data
* Channels can be configured to enable one:one, one:many, and/or many:many communications by changing settings for who can receive or send data in the channel scope
* Topics are used by channels, and it defines what kind of data can be send/retrieved  to/from a channel, A channel can have multiple different topics

On the UI, from the left navigation menu, under ‘Channels’, navigate to the ‘Channel management’. Here is the section you manage all your channels

<figure><img src="https://lh6.googleusercontent.com/ODs7n_EzYDoQnxJjqEU_J00iRRpwhjOgxHasA3OsS_4KjDx8dGjTjgd6jMQLrB3lDGB27Vq3bo_-ADOlT20x31Jp7sUrw7vv6JNFANfTkREPhBS6xawOTGiBoVD9QifGSLRXKro8hdmiGgHNGENzO0s" alt=""><figcaption></figcaption></figure>

#### **4.1 Creating a Publish Channel**

To create a channel, simply click ‘Create’ on the page.&#x20;

In the pop-up modal, you can define the channel details.

The example below shows creating a ‘Messaging’ Publish channel named ‘demo.pub’; when you have defined your channel details click ‘Next’,&#x20;

<figure><img src="https://lh6.googleusercontent.com/pjbCRE8D9VIV3Q6zbY8GWFBYmIaIRW34mogb1Eq3dMBOa38xVt5zSIFDSzo2rMFjxyJJi9zQyfVZ_gknI2ZreX8zcDzBzQ93JHHoCdzPyy-Xpf2XjEWc9fu1bEV8Dn6Kz-LG8ya3y6-mPoUXhwaxWAc" alt=""><figcaption></figcaption></figure>

At the ‘Restrictions’ tab, you are able to restrict the recipients by \`DID\` or ‘Role’, this will make sure only defined recipients will receive messages from this channel.&#x20;

{% hint style="info" %}
In Energy Web ecosystem, DIDS and Roles have below format

* EW main chain DID format: \`did:ethr:ewc:WALLET\_ADDRESS\`
* EW volta chain DID format: \`did:ethr:volta:WALLET\_ADDRESS\`
* EW role format: \`ROLE\_NAME.roles.APP\_NAME\`
  {% endhint %}

<figure><img src="https://lh6.googleusercontent.com/f4NjZNFKG_cemFnDie2Sd0ic24zFYrKmSBRXpjfXEXos9tbhQ9EfIA18H6hAzj3hKIeJP7PvIyc06lzYpjvHntxTkJdq6caKmZVKQJmscHh26RaWKBUX71yr1zKSRU43EOffMC07G3WPGHr4B18-p5Y" alt=""><figcaption></figcaption></figure>

Make sure you click the ‘Save’ button after you put in the recipient DID or Role. To  add multiple recipients, repeat this step as necessary.  &#x20;

To proceed to the next step, click “Next”.&#x20;

On the next screen, you will define what topics to add to this channel.&#x20;

<figure><img src="https://lh3.googleusercontent.com/aoNi3QczdfIQiE5FkdNx85gmCsQ8NUfI2Ukrbbflv8CBn8xlk72T3Ka95UpUH-oDfV6OdQl81eO-Fpyo3Py3LbxbD8vvwXBhAVZKFdR5bOg_msVtbuAYkmg28oQgEo0PqUyiZH38WSajVIpm6_CMZ98" alt=""><figcaption></figcaption></figure>

You can select your desired application from the ‘Select Application’ dropdown, then the available topics belonging to the application will be shown in the ‘topics’ dropdown, click on the topic to add, you can select multiple topics to this channel.

<figure><img src="https://lh4.googleusercontent.com/5DxQ4hwtA53OBpVncFC_85pfs3ghDDhI111cD8_oSQsWeKNubuecPm8-TWVHQ9n2XC08ftKZbGPRzK8UvUqazwQAXV_oIoQz28d42wdm0xfZoW9o4LWkl--QXyVXKNpdJeW4ORTI2kDQ3gyv0CtTb4g" alt=""><figcaption></figcaption></figure>

At the last step you can review all the channel details; if you need to revise any settings, click back. When you have confirmed all settings, click "submit" to create the channel. &#x20;

<figure><img src="https://lh5.googleusercontent.com/Mq1LHeTaIcLIOrE1bVVIpWIT7hQJhjlyQ_e92U3MRNYdGrIh2y_08h92gUGxTSa9TJAseAnA5P4GbOqdUK6F86SuTAEMAMZspaS7H6V_FSKlmR0FOKBfAaSpMItLvwg1hisfTzIZ0WB7tD0vGgFGHEo" alt=""><figcaption></figcaption></figure>

After clicking ‘submit’,  The channel will be shown on the channel list.&#x20;

<figure><img src="https://lh6.googleusercontent.com/K9nSbUQNTqQj-UpUcOWlRmXWvRE19Lza8jcA6q01rKN9PXmET3CmIHxuRQ8WVIgfUGq5_p1D8620s92jgyvavTFGa75oRajDTQt5C5sHuvVwJkpQiVAJ2Ym3X95d0lCES1KAaMT-w9A9ivltVm_iHa4" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
A ‘Publish’ channel is used to send data to other recipients. You will need a separate ‘Subscribe’ channel to receive data from others. You can create as many channels as necessary by following the above steps.&#x20;
{% endhint %}

#### **4.2 Creating a Subscribe Channel**

Creating a ‘Subscribe’ channel is exactly the same process as 'Publish' channel, but selecting the channel type ‘Subscribe’&#x20;

<figure><img src="https://lh4.googleusercontent.com/uc1sI5p5XNjEenQhoBzxEuMKk1pn35FapVa5zgr_jFciQsV6sFsO6qOl8cy2oTBHvYb8CjZyh_kPQA8Gi97EcZfP481BNyKJ4ZGqNF7ILrl__7qPsf0LbdZWfMsTjZeo1puek3ReNM7mGqGhJAj7Gvc" alt=""><figcaption></figcaption></figure>

And at the ‘Restrictions’ section, we can restrict whom we only want to receive data from.&#x20;

*For demonstration purposes, we restrict to only receive data from senders who has role ‘‘admin.roles.marketplace.energyweb.iam.ewc’*

<figure><img src="https://lh4.googleusercontent.com/vTr2ECmw8DuXyV0UyjXqDiaTDES3dbDPP9qwsAhiqWV9aQForEWdoduUxN6enIlGjup3uC2YO_h1tjSsK24K3Pg0O60_KUTwP1FU-7AXbk5TMJ3VLczJ9r5_2nlCUxRnK4jH0v6i6oKQE7iM6sjaCJY" alt=""><figcaption></figcaption></figure>

On the Topics tab, same concept as above publish channel, here we restrict what kind of data we want to retrieve from this channel.

<figure><img src="https://lh3.googleusercontent.com/bxbjKRUkQdv7qSHaYIAnmsWWkVXlxx06j5O4AS921pmdcTfuvYCxzdcsyAO9gKvmk6vJ1xV_NePByQVesYfhZ31Qg8yzWWl1h-VfhEhG-AJdl7pzjTq-s-Eqw1fSwFchKcgMIghQ5pnVfcIsaxw_RXo" alt=""><figcaption></figcaption></figure>

And review all the details and submit our ‘Subscribe’ channel.&#x20;

<figure><img src="https://lh4.googleusercontent.com/A7n3qx2kXCOubUiMNbFsdVIX_WtmNGOvmIIle3msvVd4V8lgq0APO_wltd22w2PFQG7-JB6Ty9eNyyR2UOy2y06oI9GLcX2VhJTblZoWi9dqm3z02aFSgJSjqWnqVdxPqblkbMUA63p_gziJjvLBFpQ" alt=""><figcaption></figcaption></figure>

We should have both channels shown under ‘Channel management’

<figure><img src="https://lh4.googleusercontent.com/PEjHTle-3rdVH6HnUNeAVf_Zc31PTjJTYk0ix0NsbdduiWFrwho7K45A3_1rNTohqLItSL44e30Z88jf-7OymjkDLy5VAqMFrEMshyH2pvZa4Vqz1CGg2f2ZQK0Xgfds8IhXQfkSRa2mksgWqUO3Ffs" alt=""><figcaption></figcaption></figure>

This is all about channel creating and how to implement a topic. &#x20;

<br>

### 5. Demo Integration - test Sending / Receiving data.

{% embed url="<https://youtu.be/lW89SHYbERA>" %}

{% hint style="info" %}
The above video demonstrates client A (DID ends 49Cc9) sends a message by API to client B (DID ends 64946), and client B successfully retrieved the message by API.
{% endhint %}

The Digital Spine Integration Client has an API swagger page, which shows you the list of endpoints available for integration.&#x20;

You can access the swagger integration APIs page from ‘Integration APIs’ from the left side nav.&#x20;

&#x20;Click ‘Open’ Rest API.&#x20;

<figure><img src="https://lh6.googleusercontent.com/11eDN1sMQY0ar8_eCjUDLgxscCaCLKZDxrH518fHutWR69vot1yPcsC5u9tKoPwRyTu48WxlssyFnXNkAd_MnFaCdalegUOE2zVnaDDNlIyzofCcmurvaU9R6FDviMjqfgfq1dTgzbqMoujwbT97vvc" alt=""><figcaption></figcaption></figure>

On the swagger page, scroll down to the ‘Messaging’ section&#x20;

<figure><img src="https://lh3.googleusercontent.com/3gDmwb-9I9HbOabLXiLrFZNnKITbp3nbGGo9z8FgZIudb6Bc8qHhSld1RJYqXmZxBZOMSRSTLIli_MK8_p_kSjawNNhDcsK-b-UPf4L587qjCZjM9RrwPa2J6PNA9RsNlVhQGBQP0ub_hWzb369IHpc" alt=""><figcaption></figcaption></figure>

You can find detailed information about how to integrate with those endpoints.&#x20;

#### **5.1 Example Post data to a Channel**

To post a message to the newly created ‘demo.pub’ channel,  the example payload will be formatted as shown below:

<pre class="language-json"><code class="lang-json">{
    "fqcn": "demo.pub",
    "topicName": "sample_topic",
    "topicVersion": "0.0.1",
<strong>    "topicOwner": "marketplace.apps.energyweb.iam.ewc",
</strong>    "payload": "{ \"message\": \"This is my first demo message\" }"
}
</code></pre>

You can POST above payload to the D.S.I Client’s endpoint \`/api/v2/messages\`

You can get all the payload info from the channel details on the  D.S.I Client’s UI, click to open the 'demo.pub' channel  from the channel list under ‘Channels’ > ‘Channel management’

<figure><img src="https://lh4.googleusercontent.com/PEjHTle-3rdVH6HnUNeAVf_Zc31PTjJTYk0ix0NsbdduiWFrwho7K45A3_1rNTohqLItSL44e30Z88jf-7OymjkDLy5VAqMFrEMshyH2pvZa4Vqz1CGg2f2ZQK0Xgfds8IhXQfkSRa2mksgWqUO3Ffs" alt=""><figcaption></figcaption></figure>

\
Here are the channel and topic details

<figure><img src="https://lh4.googleusercontent.com/En9Iy_nwun9oPLwuX8zt546VLN_OEHT2L-C39h_CsC1dMenUjrR093dVcVkkK4HVVBhJK_kfQrZNebMpSz4rjZy8nz7BCOhDeKaa8ZcW7w9mT7bXI0jRLG2PsQHsvSFoOz_n4Aa4G8LR2mgsE5oG0Tc" alt=""><figcaption><p>demo.pub channel details modal</p></figcaption></figure>

<figure><img src="https://lh6.googleusercontent.com/Ry13iSpR-c4snAsTOqYV39a5BozZdueYkEjbzqt0KrkYHCNjNoZ3vUBg2VsWINiPDNneKG9fVD0kBLjQEEg53ala4UlxziB0BetS4NdbKif6_XSu9kNaD-lAedj_4C3VWW63fJEH2G83FO_fq-fl5GA" alt=""><figcaption><p>sample_topic details</p></figcaption></figure>

So payload info has below relationship with what is shown on the channel detail and topic detail modals.

<table><thead><tr><th width="186.33333333333331">Payload field</th><th>UI label</th><th>Value</th></tr></thead><tbody><tr><td>fqcn</td><td>Namespace on Channel details</td><td><code>demo.pub</code></td></tr><tr><td>topicName</td><td>Topic Name</td><td><code>sample_topic</code></td></tr><tr><td>topicVersion</td><td>Version on Topic details</td><td><code>0.0.1</code></td></tr><tr><td>topicOwner</td><td>Namespace on Topic details</td><td><code>marketplace.apps.energyweb.iam.ewc</code></td></tr></tbody></table>

**5.2 Example Get data from a Channel**

To receive data from a channel, by following the documentation, You can retrieve data from GET endpoint '/api/v2/messages'

An example request path can be `/api/v2/messages?fqcn=demo.sub&amount=10&topicName=sample_topic&topicOwner=marketplace.apps.energyweb.iam.ewc&clientId=demo_user`

Query breakdown will be&#x20;

* fqcn = demo.sub
* amount = 10
* topicName = sample\_topic
* topicOwner = marketplace.apps.energyweb.iam.ewc
* clientId = demo\_user

The query information can also be retrieved from the channel detail as explained in [the previous step](#5.1-example-post-data-to-a-channel).

### 6. Conclusion&#x20;

Those are the main steps to get you started with the Digital Spine Integration interface, You can start communicating with other DSI clients integrated with the same application.&#x20;

And contact us at <digital-spine.support@energweb.org> to acquire the 'topiccreator' role to create topics to test scenarios based on your business requirement.&#x20;
