> ## Documentation Index
> Fetch the complete documentation index at: https://cometchat-22654f5b-docs-rn-guide-message-privately.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Share Invite

> Add invite sharing in CometChat Calls SDK v5 on JavaScript so users can share call links and bring participants into sessions.

Allow participants to share call invitations with others using the share invite feature.

## Share Invite Button

### Show Share Invite Button

By default, the share invite button is hidden. To show it:

```javascript theme={null}
const callSettings = {
  hideShareInviteButton: false,
  // ... other settings
};
```

### Listen for Share Invite Button Clicks

Handle share invite button clicks to implement your sharing logic:

```javascript theme={null}
CometChatCalls.addEventListener("onShareInviteButtonClicked", () => {
  console.log("Share invite button clicked");
  // Implement your sharing logic
  shareCallInvite();
});
```

## Implementing Share Functionality

When the share invite button is clicked, you can implement various sharing methods:

### Web Share API

Use the native Web Share API for mobile-friendly sharing:

```javascript theme={null}
async function shareCallInvite() {
  const shareData = {
    title: "Join my call",
    text: "Click the link to join my video call",
    url: `https://yourapp.com/call/${sessionId}`
  };

  if (navigator.share) {
    try {
      await navigator.share(shareData);
      console.log("Shared successfully");
    } catch (error) {
      console.log("Share cancelled or failed");
    }
  } else {
    // Fallback for browsers that don't support Web Share API
    copyToClipboard(shareData.url);
  }
}
```

### Copy to Clipboard

Provide a simple copy-to-clipboard option:

```javascript theme={null}
function copyToClipboard(text) {
  navigator.clipboard.writeText(text).then(() => {
    console.log("Link copied to clipboard");
    // Show a toast notification
  }).catch(err => {
    console.error("Failed to copy:", err);
  });
}
```

### Custom Share Dialog

Create a custom share dialog with multiple options:

```javascript theme={null}
function showShareDialog() {
  const callLink = `https://yourapp.com/call/${sessionId}`;
  
  // Show your custom dialog with options like:
  // - Copy link
  // - Share via email
  // - Share via SMS
  // - Share to social media
}
```
