How to make Dynamic URL for Browser and Mobile Application - for Customer Confirmation mail URL?
-
21-02-2021 - |
Question
Magento 2 gives us the ability to take more control of the customer account creation process.
There is a special configuration setting located in
Admin under Stores → Configuration → Customers → Customer Configuration → Create New Account Options named Require Emails Confirmation (Yes/No)
I am receiving the mail and everything's works fine, But my concern is I have Mobile Application too for my Magento project.
And In email confirmation button I have URL like this
https://<magento.host>/customer/account/confirm/?id=123&key=b686b138f5ec5fe5ff7610b7527a9b4b
- Now, this URL is directly opens in the the browser even if customer has Installed the Application.
Now, How can I make Dynamic URL for this specific functionality, If user have Installed the application then It automatically opens in Mobile Application and if user doesn't have the application then opens in Browser.
Solution
Using the Firebase console. This is useful if you're creating promo links to share on social media. This way you can select a custom suffix and a name for the link in the Firebase console. You can track the performance of these Dynamic Links in the Firebase console or via the Analytics REST API.
API Method : POST
https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=<Firebase project key>
JSON > BODY > DATA
{
"dynamicLinkInfo": {
"domainUriPrefix": "https://<your_project>.page.link",
"link": "https://<your_project>/customtab/custom/",
"androidInfo": {
"androidPackageName": "<androidPackageName>"
},
"iosInfo": {
"iosBundleId": "<iosBundleId>"
}
}
}
RESPONSE
{
"shortLink": "<shortLink by firebase>",
"warning": [
{
"warningCode": "UNRECOGNIZED_PARAM",
"warningMessage": ""
},
{
"warningCode": "UNRECOGNIZED_PARAM",
"warningMessage": ""
}
],
"previewLink": "<previewLink by firebase>"
}