Open daniilshamraev opened 1 month ago
To be implemented in a new package major version. I am not sure there are clients supporting Mini Apps v7.8 now, so this method will not even work
My client supports v7.8, and I have already seen a mini apps that utilizes shareToStory feature. Therefore, it would be great to release it sooner, because I can't use it without downloading the native SDK along with @telegram-apps/sdk @heyqbnk
@awerc here's how you can use it:
import { postEvent } from "@telegram-apps/sdk-react";
postEvent("web_app_share_to_story" as any, {
media_url: 'image.png',
text: text.slice(0, 2048),
widget_link: {},
});
Here is typesafe way
interface CreateParams<
Params = never,
VersionedParam extends UnionKeys<Params> = never,
> {
params: Params;
versionedParams: VersionedParam;
}
declare module "@telegram-apps/sdk" {
interface MiniAppsMethods {
web_app_share_to_story: CreateParams<WepAppShareStory>;
}
}
type WepAppShareStory = {
media_url: string;
text?: string;
widget_link?: {
url: string;
name?: string;
};
}
@awerc here's how you can use it:
import { postEvent } from "@telegram-apps/sdk-react"; postEvent("web_app_share_to_story" as any, { media_url: 'image.png', text: text.slice(0, 2048), widget_link: {}, });
This method is not working for me, the console don't throw any error just the post event. Is there something I need to do to make this work?
@awerc here's how you can use it:
import { postEvent } from "@telegram-apps/sdk-react"; postEvent("web_app_share_to_story" as any, { media_url: 'image.png', text: text.slice(0, 2048), widget_link: {}, });
This method is not working for me, the console don't throw any error just the post event. Is there something I need to do to make this work?
https://github.com/lumoscompany/bilft.com/blob/7e1b46dfa1d1dcf2b442a84ff04187fd912d822f/source/features/PagesLayout.tsx#L43 Follow this file make working for me.
Is your feature request related to a problem? Please describe.
No response
Describe the solution you'd like
add shareToStory
Describe alternatives you've considered
No response
Additional context
No response