Complete guide to integrating Redirectly into your applications. From setup to production deployment.
Set up your account and create your first link
First, you'll need to get your API key from the Redirectly dashboard.
Sign in to your dashboard and your API key will be displayed automatically.
Open DashboardChoose a unique username that will become your personal subdomain. Your links will be:
https://your-username.redirectly.app/your-link
Choose carefully - usernames cannot be changed after creation!
Integrate with popular backend frameworks
npm install axios # or yarn add axios
const axios = require('axios'); const redirectly = axios.create({ baseURL: 'https://redirectly.app/api', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' } });
// Create a permanent link const createLink = async () => { try { const response = await redirectly.post('/links', { slug: 'my-awesome-link', target: 'https://example.com' }); console.log('Link created:', response.data.url); return response.data; } catch (error) { console.error('Error:', error.response?.data); } }; // Create a temporary link const createTempLink = async () => { try { const response = await redirectly.post('/v1/temp-links', { target: 'https://example.com/temp-content', ttlSeconds: 3600 // 1 hour }); console.log('Temp link:', response.data.url); return response.data; } catch (error) { console.error('Error:', error.response?.data); } };
Configure iOS, Android, and Flutter apps for deep linking
dependencies: flutter_redirectly: ^2.0.0
import 'package:flutter_redirectly/flutter_redirectly.dart'; class RedirectlyService { static final FlutterRedirectly _redirectly = FlutterRedirectly(); static Future<void> initialize() async { await _redirectly.initialize(RedirectlyConfig( apiKey: 'YOUR_API_KEY', baseUrl: 'https://redirectly.app', enableDebugLogging: true, )); } static FlutterRedirectly get instance => _redirectly; }
// Listen for incoming links class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State<MyApp> { @override void initState() { super.initState(); _setupLinkHandling(); } void _setupLinkHandling() { // Listen to link clicks when app is running RedirectlyService.instance.onLinkClick.listen((clickEvent) { if (clickEvent.error == null) { // Navigate based on username and slug Navigator.of(context).pushNamed( '/${clickEvent.username}/${clickEvent.slug}' ); } else { // Handle error ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text('Error: ${clickEvent.error}')), ); } }); // Check for initial link (cold start) _checkInitialLink(); } void _checkInitialLink() async { final initialLinkEvent = await RedirectlyService.instance.getInitialLink(); if (initialLinkEvent != null) { // Handle initial link same way as above Navigator.of(context).pushNamed( '/${initialLinkEvent.username}/${initialLinkEvent.slug}' ); } } }
Add the following to your android/app/src/main/AndroidManifest.xml
:
<activity android:name=".MainActivity" android:exported="true" android:launchMode="singleTop" android:theme="@style/LaunchTheme"> <!-- Existing intent filters --> <!-- Add this for Redirectly links --> <intent-filter android:autoVerify="true"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="https" android:host="YOUR_USERNAME.redirectly.app" /> </intent-filter> </activity>
Configure Associated Domains in your iOS project to enable deep linking:
Add this domain to your Associated Domains capability:
applinks:YOUR_SUBDOMAIN.redirectly.app
In Xcode, go to your app target → Signing & Capabilities → Add Capability → Associated Domains
Xcode: Target → Signing & Capabilities → Associated Domains
Alternatively, add the following to your ios/Runner/Runner.entitlements
file:
<key>com.apple.developer.associated-domains</key> <array> <string>applinks:YOUR_SUBDOMAIN.redirectly.app</string> </array>
If the entitlements file doesn't exist, it will be created automatically when you add Associated Domains through Xcode.
The flutter_redirectly package uses pure Dart code with no native dependencies, making it faster to build and easier to debug!
Use your dashboard or API to create a test link like test-mobile
Send yourself the link via SMS/email and tap it. Your app should open and handle the link.
Force-close your app, then tap the link again to test cold start handling.
Tips for production deployment and optimization
You now have everything you need to integrate Redirectly into your applications. Create powerful, trackable short links with deep linking support across all platforms.