Skip to main content
SDK v7.x · Last verified March 2026 · iOS · Android · Web · Flutter
// 1. Get share link configuration
const config = await Client.getShareableLinkConfiguration();

// 2. Build a share URL for a post
const shareUrl = `${config.baseUrl}/post/${postId}`;

// 3. Handle incoming deep link
Client.handleDeepLink(incomingUrl, (resolved) => {
  if (resolved.type === 'post') navigateToPost(resolved.postId);
  if (resolved.type === 'community') navigateToCommunity(resolved.communityId);
});
Full walkthrough below ↓
Platform note — code samples below use TypeScript. Every method has an equivalent in the iOS (Swift), Android (Kotlin), and Flutter (Dart) SDKs — see the linked SDK reference in each step.
Shareable links turn your users into a growth engine. When a user shares a post or community to WhatsApp, Twitter, or SMS, the recipient can tap straight into your app. This guide covers generating share URLs from the SDK, configuring link patterns in the console, and handling incoming deep links.
Prerequisites: SDK installed and authenticated → SDK Setup. Shareable links must be configured in Admin Console → Settings → Shareable Links (custom domain is optional).
After completing this guide you’ll have:
  • Shareable URLs generated for posts, communities, and user profiles
  • Deep link routing that opens your app directly to the target content
  • Share sheet integration for native OS sharing on iOS, Android, and Web

TypeScript
import { Client } from '@amityco/ts-sdk';

const getPostShareLink = async (postId: string) => {
  try {
    const config = await Client.getShareableLinkConfiguration();
    const { domain, patterns } = config;
    const postLink = domain + patterns.post.replace('{postId}', postId);
    return postLink;
  } catch (error) {
    console.error('Failed to generate share link:', error);
    return null;
  }
};

// Returns: "https://your-domain.com/posts/post-123"
Full reference → Content Sharing
Shareable links vs. in-app reposts: This guide covers external shareable links — URLs for WhatsApp, SMS, or social media that open your app via deep link. social.plus also has a distinct in-app repost mechanism: when a user reshares a post inside the app, the new post stores the original’s ID in sharedPostId and increments sharedCount on the original post. Use shareable links for viral distribution outside the app; use the repost API for in-feed resharing within the app.

Step-by-Step Implementation

1

Get the shareable link configuration

The SDK fetches your configured domain and URL patterns from the server. Call this once and cache the result — it rarely changes.
TypeScript
import { Client } from '@amityco/ts-sdk';

const config = await Client.getShareableLinkConfiguration();
// config.domain = "https://your-app.com"
// config.patterns.post = "/posts/{postId}"
// config.patterns.community = "/communities/{communityId}"
Full reference → Content Sharing
2

Generate links for different content types

Use the pattern templates to construct URLs for posts, communities, and user profiles.
TypeScript
const { domain, patterns } = config;

// Post link
const postLink = domain + patterns.post.replace('{postId}', postId);

// Community link
const communityLink = domain + patterns.community.replace('{communityId}', communityId);

// User profile link
const userLink = domain + patterns.user.replace('{userId}', userId);
Full reference → Content Sharing
3

Wire up the native share sheet

Pass the generated URL to the platform’s native share API. On web, use the Web Share API with a clipboard fallback.
TypeScript
// Web Share API
if (navigator.share) {
  await navigator.share({
    title: post.data.text?.substring(0, 50),
    url: postLink,
  });
} else {
  // Fallback: copy to clipboard
  await navigator.clipboard.writeText(postLink);
  showToast('Link copied!');
}
4

Handle incoming deep links

When your app opens from a shared link, parse the URL and navigate to the right screen. Match against the same patterns from the configuration.
TypeScript
const handleDeepLink = (url: string) => {
  const postMatch = url.match(/\/posts\/([^/]+)/);
  if (postMatch) {
    navigateToPost(postMatch[1]);
    return;
  }
  const communityMatch = url.match(/\/communities\/([^/]+)/);
  if (communityMatch) {
    navigateToCommunity(communityMatch[1]);
    return;
  }
};
5

Configure shareable links in the Admin Console

Set up your custom domain and URL patterns in Admin Console → Settings → Shareable Links:
  • Domain: Your app’s domain (e.g., https://your-app.com)
  • Post pattern: /posts/{postId}
  • Community pattern: /communities/{communityId}
  • User pattern: /users/{userId}
These patterns are served to the SDK via getShareableLinkConfiguration().

Connect to Moderation & Analytics

UIKit — Shareable link component
Track which posts and communities generate the most shares. Combine share events with impression data in Admin Console → Analytics Dashboard to measure viral coefficient.
Links to private community content should only work for authenticated users who are members. Visitors landing on a private community link should see a “Request to join” prompt, not the content.

Common Mistakes

Exposing internal object IDs in share URLs — Use the SDK’s shareable link configuration to generate safe, user-facing URLs instead of constructing them manually with raw IDs.
Not testing deep links on all platforms — iOS Universal Links, Android App Links, and web fallbacks all have different requirements. Test the full flow on each platform — especially the “app not installed” case.
Skipping deep link verification — Always validate the incoming deep link format before navigating. Malformed or tampered URLs should redirect to a safe fallback, not crash the app.

Best Practices

  • Add Open Graph meta tags to your web fallback pages so shared links show rich previews on social media
  • Use UTM parameters on share links to track which channels drive the most installs
  • Cache getShareableLinkConfiguration() at app startup — it only needs to refresh once per session
  • Show a share count on posts to create social proof and encourage more sharing
  • Pre-compose the share text with the post’s first 50 characters + the link
  • Show a “Copied!” toast when the clipboard fallback fires
  • On mobile, use the native share sheet (iOS UIActivityViewController, Android Intent.createChooser) for the best experience

Dive deeper: Posts API Reference has full parameter tables, method signatures, and platform-specific details for every API used in this guide.

Next Steps

Your next step → Post Impressions & Creator Analytics

Content is shareable — now track who’s viewing it with impression analytics and reach metrics.
Or explore related guides:

User Onboarding & Visitor Mode

Handle visitors who arrive via shared links

Build a Social Feed

Build the feed that shared links navigate to

Community Platform

Create the communities that users share