Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#238 Deep linking feature #241

Merged
merged 9 commits into from
Dec 3, 2019
Merged

#238 Deep linking feature #241

merged 9 commits into from
Dec 3, 2019

Conversation

Olegt0rr
Copy link
Contributor

@Olegt0rr Olegt0rr commented Nov 23, 2019

Description

Telegram bots have a deep linking mechanism, that allows for passing additional parameters to the bot on startup. It could be a command that launches the bot — or an auth token to connect the user's Telegram account to their account on some external service.

You can read detailed description in the source:
https://core.telegram.org/bots#deep-linking

We have add some utils to get deep links more handy.

Basic link example:

from aiogram.utils.deep_linking import get_start_link

link = await get_start_link('foo')  # result: 'https://t.me/MyBot?start=foo'

Encoded link example:

from aiogram.utils.deep_linking import get_start_link, decode_payload

link = await get_start_link('foo', encode=True)  # result: 'https://t.me/MyBot?start=Zm9v'

# and decode it back after receiving
payload = decode_payload('Zm9v')  # result: 'foo'

It's also works with get_startgroup_link util.

Fixes #238

Type of change

  • Documentation (typos, code examples or any documentation update)
  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • test_deep_linking.TestDeepLinking

@Olegt0rr Olegt0rr added the new feature Missing feature label Nov 23, 2019
@JrooTJunior JrooTJunior merged commit 528e27b into dev-2.x Dec 3, 2019
@JrooTJunior JrooTJunior deleted the #238-deeplinking branch May 2, 2020 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature Missing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add function or method for deep linking
2 participants