# Share text with WhatsApp and open a Telegram conversation

Canonical HTML: https://p-hatan.com/deeplink-x/use-cases/share-message/

DeeplinkX 1.5.8.

Prepare a message or share text in an external application. The user remains responsible for choosing recipients and completing any external-app interaction; these actions do not silently send messages in the background.

## Reusable Flutter example

```dart
import 'package:deeplink_x/deeplink_x.dart';

Future<bool> shareWithWhatsApp(String input) {
  final text = input.trim();
  if (text.isEmpty) return Future.value(false);

  return DeeplinkX().launchAction(WhatsApp.shareText(text: text));
}

Future<bool> openTelegramMessage(String usernameInput, String messageInput) {
  final username = usernameInput.trim();
  final message = messageInput.trim();
  if (username.isEmpty || message.isEmpty) return Future.value(false);

  return DeeplinkX().launchAction(
    Telegram.sendMessage(username: username, message: message),
  );
}
```

In a user interface, show a specific validation message before calling these helpers so empty input is distinguishable from a failed launch. The existing page reports “Enter text to share” or “Enter both a Telegram username and message.”

## Current example inputs and behavior

| Input | Default |
| --- | --- |
| WhatsApp share text | `Try DeeplinkX for type-safe Flutter deeplinks.` |
| Telegram username | `telegram` |
| Telegram message | `Hello from the DeeplinkX example!` |

The page trims values, rejects required empty fields, constructs the corresponding action, and calls `launchAction`. It disables repeat requests while launching and shows the final handoff result. Store fallback is not opted into by these calls; normal action fallback remains enabled.

## Configuration and limits

- Use the [WhatsApp guide](/deeplink-x/apps/whatsapp/) and [Telegram guide](/deeplink-x/apps/telegram/) for provider actions and limitations.
- Configure the relevant [Android package visibility](https://github.com/DeepLinkX/DeeplinkX/blob/00d9d2c7c1affe4e2ee459a01afeba82a1480eac/example/android/app/src/main/AndroidManifest.xml) and [iOS query schemes](https://github.com/DeepLinkX/DeeplinkX/blob/00d9d2c7c1affe4e2ee459a01afeba82a1480eac/example/ios/Runner/Info.plist).
- The sample username is a public demo destination; replace it with the intended recipient. Do not treat it as an official DeeplinkX support account.
- Provider login, recipient availability, account policy, user confirmation, and eventual delivery are outside the launch API.
- A returned `true` means a launch request succeeded, including possible fallback; it does not confirm that any message was sent.

## UI behavior

- Whitespace-only WhatsApp text is rejected before launch.
- Either missing Telegram field is rejected before launch; trimmed values reach the action.
- Valid inputs create `WhatsAppShareTextAction` or `TelegramSendMessageAction` with the expected content.
- Native and documented fallback handoffs receive accurate result labels.
- Repeat taps while pending do not send duplicate launch requests.

## Source code

- [ShareMessagePage, `_share`, `_message`, `_launch`](https://github.com/DeepLinkX/DeeplinkX/blob/00d9d2c7c1affe4e2ee459a01afeba82a1480eac/example/lib/use_cases/share_message_page.dart)
- [Launch/fallback algorithm](https://github.com/DeepLinkX/DeeplinkX/blob/00d9d2c7c1affe4e2ee459a01afeba82a1480eac/lib/src/core/deeplink_x.dart)

[All use cases](/deeplink-x/use-cases/) · [Social support links](/deeplink-x/use-cases/about-support/) · [Meetings and communities](/deeplink-x/use-cases/meeting-community/)

