Title: add `random_id` optional parameter to `send_message` method to ensure idempotency · Issue #70 · hydrogram/hydrogram · GitHub
Open Graph Title: add `random_id` optional parameter to `send_message` method to ensure idempotency · Issue #70 · hydrogram/hydrogram
X Title: add `random_id` optional parameter to `send_message` method to ensure idempotency · Issue #70 · hydrogram/hydrogram
Description: Checklist I believe the idea is awesome and would benefit the framework I have searched in the issue tracker for similar requests, including closed ones Description When working with messaging services, it is crucial that listeners have ...
Open Graph Description: Checklist I believe the idea is awesome and would benefit the framework I have searched in the issue tracker for similar requests, including closed ones Description When working with messaging serv...
X Description: Checklist I believe the idea is awesome and would benefit the framework I have searched in the issue tracker for similar requests, including closed ones Description When working with messaging serv...
Opengraph URL: https://github.com/hydrogram/hydrogram/issues/70
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"add `random_id` optional parameter to `send_message` method to ensure idempotency","articleBody":"### Checklist\n\n- [x] I believe the idea is awesome and would benefit the framework\n- [x] I have searched in the issue tracker for similar requests, including closed ones\n\n### Description\n\nWhen working with messaging services, it is crucial that listeners have idempotent logic, which ensures that no operations will be duplicated if the service fails and tries to reprocess.\n\nMTProto has a parameter where you can define an ID, which will ensure that the message is sent only once:\n\n\u003e **random_id**\t\tlong\n\u003e \"Unique client message ID required to prevent message resending\"\n\u003e\n\u003e https://core.telegram.org/method/messages.sendMessage\n\nIt exists in the raw functions, but the abstraction that wraps it doesn't have a parameter that we can pass to it:\n\n- https://github.com/hydrogram/hydrogram/blob/dev/hydrogram/methods/messages/send_message.py#L149\n- https://github.com/hydrogram/hydrogram/blob/dev/hydrogram/methods/messages/send_photo.py#L192\n- https://github.com/hydrogram/hydrogram/blob/dev/hydrogram/methods/messages/send_poll.py#L216\n- https://github.com/hydrogram/hydrogram/blob/dev/hydrogram/methods/messages/send_sticker.py#L166\n- https://github.com/hydrogram/hydrogram/blob/dev/hydrogram/methods/messages/send_venue.py#L127\n- https://github.com/hydrogram/hydrogram/blob/dev/hydrogram/methods/messages/send_video.py#L265\n- https://github.com/hydrogram/hydrogram/blob/dev/hydrogram/methods/messages/send_video_note.py#L191\n- https://github.com/hydrogram/hydrogram/blob/dev/hydrogram/methods/messages/send_voice.py#L183\n\nAlternatively I am calling the raw function directly.","author":{"url":"https://github.com/d3cryptofc","@type":"Person","name":"d3cryptofc"},"datePublished":"2025-09-02T13:54:46.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/70/hydrogram/issues/70"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0814d67f-d1fb-8ef5-9603-a13b8f30a380 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8C70:3C277B:1A6EFF0:23AC57F:6972B9EE |
| html-safe-nonce | f0911f0ba613d25c94eb2989407e24a6a483f77565078173c86dd9ed9f0b5ec1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QzcwOjNDMjc3QjoxQTZFRkYwOjIzQUM1N0Y6Njk3MkI5RUUiLCJ2aXNpdG9yX2lkIjoiODMwNzExNTA3NzU0NjQ1NzU4MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 31925bac5ae8e2f989188e01c5bce5c9f4cd2cb26182ed337e648dc0ade855b6 |
| hovercard-subject-tag | issue:3376153660 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/hydrogram/hydrogram/70/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ff018a2bb65edf72d181b32d1a8f2757e2a4aae7021409cec8e97bcbcd118856/hydrogram/hydrogram/issues/70 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ff018a2bb65edf72d181b32d1a8f2757e2a4aae7021409cec8e97bcbcd118856/hydrogram/hydrogram/issues/70 |
| og:image:alt | Checklist I believe the idea is awesome and would benefit the framework I have searched in the issue tracker for similar requests, including closed ones Description When working with messaging serv... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | d3cryptofc |
| hostname | github.com |
| expected-hostname | github.com |
| None | 51c0d0848f5569c6fa2198e9d69bd5f8f94a83c9fa3659e40728e7732afab130 |
| turbo-cache-control | no-preview |
| go-import | github.com/hydrogram/hydrogram git https://github.com/hydrogram/hydrogram.git |
| octolytics-dimension-user_id | 153278131 |
| octolytics-dimension-user_login | hydrogram |
| octolytics-dimension-repository_id | 711555265 |
| octolytics-dimension-repository_nwo | hydrogram/hydrogram |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 711555265 |
| octolytics-dimension-repository_network_root_nwo | hydrogram/hydrogram |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 10c5e2f2307495b2750073db87e9a5d3356a924f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width