> For the complete documentation index, see [llms.txt](https://help.textrp.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.textrp.io/deeplinks/implementation-guide.md).

# Implementation Guide

Integrating deep links for direct user communication and room access in TextRP involves dynamically constructing URLs that utilize the Matrix protocol's capabilities. Here’s how you can generate these deep links:

**Generating Deep Links to Users:**

```javascript
function createUserDeepLink(walletAddress) {
  const serverDomain = 'synapse.textrp.io';
  return `https://app.textrp.io/#/user/@${walletAddress}:${serverDomain}`;
}
```

**Generating Deep Links to Rooms:**

```javascript
function createRoomDeepLink(roomIdentifier) {
  const serverDomain = 'synapse.textrp.io';
  const roomPrefix = roomIdentifier.startsWith('!') ? 'room/' : 'room/#';
  return `https://app.textrp.io/#/${roomPrefix}${roomIdentifier}:${serverDomain}`;
}
```

To use these functions, simply pass the wallet address or room ID/alias to the respective function. This will return a string containing the complete deep link which can be used in your application to redirect users directly to the desired chat or room in TextRP.

### EXAMPLE

In this scenario, we have a website featuring an NFT, and we want to provide a "Contact Seller" button. When clicked, this button uses the NFT owner's wallet address to create a deep link for direct messaging in TextRP. Below is an example implementation:

**HTML Sample with NFT Owner Contact Feature:**

```html
<!DOCTYPE html>
<html>
<head>
    <title>NFT Marketplace</title>
</head>
<body>
    <h2>NFT Details</h2>
    <!-- Display NFT Information -->
    <img src="path_to_nft_image.jpg" alt="NFT Image">
    <p>NFT Name: Awesome NFT</p>
    <p id="nftOwner">Owner Wallet Address: rExampleOwnerWalletAddress</p>
    <button onclick="contactSeller()">Contact Seller</button>

    <script>
        function contactSeller() {
            var ownerWalletAddress = document.getElementById('nftOwner').innerText.split(': ')[1];
            var contactLink = `https://app.textrp.io/#/user/@${ownerWalletAddress}:synapse.textrp.io`;
            window.location.href = contactLink;
        }
    </script>
</body>
</html>
```

In this HTML:

* The NFT's image and details are displayed.
* The `contactSeller()` function retrieves the NFT owner's wallet address from the page (in this case, hardcoded for demonstration purposes) and constructs a deep link for messaging the seller in TextRP.
* Clicking the "Contact Seller" button will direct the user to a TextRP chat with the NFT owner.

This approach seamlessly integrates the ability to contact an NFT owner directly from an NFT marketplace or gallery website.

**Best Practices**

* Ensure the wallet addresses and room IDs are accurate and correspond to the intended recipient or room.
* Encode URL parameters to handle special characters and spaces where necessary.
* Test each deep link to confirm it directs to the correct location within the TextRP app.

By adhering to this guide, developers can effectively incorporate deep links into their services, facilitating direct and efficient access to TextRP's messaging features.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.textrp.io/deeplinks/implementation-guide.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
