firebase-dynamic-link-generator
Simple python client to generate Firebase Dynamic Links. It allows to
use a custom domain and fields for generate links for android and ios.
Requirements
Installation
pip3 install firebase-dynamic-link-generator
Usage
from firebase_dynamic_link_generator import GenerateFirebaseDynamicLink
SERVICE_FILE = 'YOUR_SERVICE_ACCOUNT_JSON_FILE_PATH'
DOMAIN = 'example.page.link'
NAME = "NAME_OF_LINK"
fdl = GenerateFirebaseDynamicLink(DOMAIN, SERVICE_FILE, NAME)
linkinfo_params = {
"androidInfo": {
"androidPackageName": 'PACKAGE_NAME',
"androidFallbackLink": 'FALL_BACK_LINK',
"androidMinPackageVersionCode": '1'
},
}
short_link = fdl.generate_dynamic_link('http://google.com', linkinfo_params)
suffix_params = {
"option": "CUSTOM",
"customSuffix": "CT2213"
}
short_link = fdl.generate_dynamic_link('http://google.com', linkinfo_params, suffix_params)
api_key
: Key from firebase consoledomain
: Domain uri prefix created in firebase console - Dynamic Link. For example example.page.link
or your custom domain.linkinfo_params
: Dictionary of optional params. For example:
{
"domainUriPrefix": string,
"link": string,
"androidInfo": {
"androidPackageName": string,
"androidFallbackLink": string,
"androidMinPackageVersionCode": string
},
"iosInfo": {
"iosBundleId": string,
"iosFallbackLink": string,
"iosCustomScheme": string,
"iosIpadFallbackLink": string,
"iosIpadBundleId": string,
"iosAppStoreId": string
},
"navigationInfo": {
"enableForcedRedirect": boolean,
},
"analyticsInfo": {
"googlePlayAnalytics": {
"utmSource": string,
"utmMedium": string,
"utmCampaign": string,
"utmTerm": string,
"utmContent": string
},
"itunesConnectAnalytics": {
"at": string,
"ct": string,
"mt": string,
"pt": string
}
},
"socialMetaTagInfo": {
"socialTitle": string,
"socialDescription": string,
"socialImageLink": string
}
}
suffix_params
: Dictionary of optional params. For example:
{
"option": "SHORT" or "UNGUESSABLE" or "CUSTOM",
"customSuffix": string,
}
Reference
https://firebase.google.com/docs/dynamic-links/rest
https://firebase.google.com/docs/reference/dynamic-links/link-shortener