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:
Generating Deep Links to Rooms:
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:
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.
Last updated