{"id":51234852,"url":"https://github.com/ivanodintsov/telegram-transformer","last_synced_at":"2026-06-28T19:30:34.348Z","repository":{"id":104291283,"uuid":"582018030","full_name":"ivanodintsov/telegram-transformer","owner":"ivanodintsov","description":"Telegram transformer is a library that makes it simple for you to transform telegram message to any markup.","archived":false,"fork":false,"pushed_at":"2026-01-24T17:08:32.000Z","size":108,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-25T06:30:38.819Z","etag":null,"topics":["bot","telegram","telegram-formatter","telegram-parse","telegram-transformer"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/telegram-transformer","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ivanodintsov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-12-25T10:23:47.000Z","updated_at":"2026-01-24T17:08:37.000Z","dependencies_parsed_at":"2023-05-07T02:05:14.389Z","dependency_job_id":null,"html_url":"https://github.com/ivanodintsov/telegram-transformer","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/ivanodintsov/telegram-transformer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanodintsov%2Ftelegram-transformer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanodintsov%2Ftelegram-transformer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanodintsov%2Ftelegram-transformer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanodintsov%2Ftelegram-transformer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivanodintsov","download_url":"https://codeload.github.com/ivanodintsov/telegram-transformer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanodintsov%2Ftelegram-transformer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34901959,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-28T02:00:05.809Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot","telegram","telegram-formatter","telegram-parse","telegram-transformer"],"created_at":"2026-06-28T19:30:33.445Z","updated_at":"2026-06-28T19:30:34.342Z","avatar_url":"https://github.com/ivanodintsov.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cheader\u003e\n\u003cdiv align=\"center\"\u003e\n\u003ch1 align=\"center\"\u003eTelegram message transformer\u003c/h1\u003e\n\n\u003ca href=\"https://www.npmjs.com/package/telegram-transformer\"\u003e\n  \u003cimg src=\"https://img.shields.io/npm/v/telegram-transformer.svg\" alt=\"Latest Release\"\u003e\n\u003c/a\u003e\n\n\u003c/div\u003e\n\u003c/header\u003e\n\n## Introduction\n\nTelegram transformer is a library that makes it simple for you to transform telegram message to any markup.\n\n## Getting started\n\n### Installation\n\n```shellscript\n$ npm install telegram-transformer\n```\n\nor\n\n```shellscript\n$ yarn add telegram-transformer\n```\n\n### Example\n\n```js\nimport formatText, { htmlFormatters } from 'telegram-transformer';\nimport { MessageEntity } from 'typegram';\n\nconst text =\n  'Hello @username #awesome_hashtag $USD /start@jobs_bot https://telegram.org do-not-reply@telegram.org +1-212-555-0123 bold text italic text underlined text strikethrough text spoiler message monowidth string monowidth block text_link custom_emoji text_mention';\nconst entities: MessageEntity[] = [\n  { offset: 6, length: 9, type: 'mention' },\n  { offset: 16, length: 16, type: 'hashtag' },\n  { offset: 25, length: 7, type: 'bold' },\n  { offset: 33, length: 4, type: 'cashtag' },\n  { offset: 38, length: 15, type: 'bot_command' },\n  { offset: 54, length: 20, type: 'url' },\n  { offset: 75, length: 25, type: 'email' },\n  { offset: 101, length: 15, type: 'phone_number' },\n  { offset: 117, length: 9, type: 'bold' },\n  { offset: 127, length: 11, type: 'italic' },\n  { offset: 139, length: 5, type: 'underline' },\n  { offset: 144, length: 10, type: 'underline' },\n  { offset: 144, length: 5, type: 'bold' },\n  { offset: 155, length: 18, type: 'strikethrough' },\n  { offset: 174, length: 15, type: 'spoiler' },\n  {\n    offset: 223,\n    length: 9,\n    type: 'text_link',\n    url: 'https://telegram.org/',\n  },\n  {\n    offset: 233,\n    length: 12,\n    type: 'custom_emoji',\n    custom_emoji_id: '12345',\n  },\n  {\n    offset: 246,\n    length: 12,\n    type: 'text_mention',\n    user: {\n      id: 9876543210,\n      is_bot: false,\n      first_name: 'First Name',\n    },\n  },\n];\n\nconst formatted = formatText(text, entities, { formatters: htmlFormatters });\n\nconsole.log(formatted);\n\n/*\n{\n  text: \"Hello \u003ca href='https://t.me/username'\u003e@username\u003c/a\u003e \u003ca href='#awesome_hashtag'\u003e#awesome_\u003cstrong\u003ehashtag\u003c/strong\u003e\u003c/a\u003e $USD /start@jobs_bot \u003ca href='https://telegram.org'\u003ehttps://telegram.org\u003c/a\u003e \u003ca href='mailto:do-not-reply@telegram.org'\u003edo-not-reply@telegram.org\u003c/a\u003e \u003ca href='tel:+1-212-555-0123'\u003e+1-212-555-0123\u003c/a\u003e \u003cstrong\u003ebold text\u003c/strong\u003e \u003ci\u003eitalic text\u003c/i\u003e \u003cu\u003eunder\u003c/u\u003e\u003cu\u003e\u003cstrong\u003elined\u003c/strong\u003e text\u003c/u\u003e \u003cstrike\u003estrikethrough text\u003c/strike\u003e \u003cspan class='spoiler-hover'\u003espoiler message\u003c/span\u003e monowidth string monowidth block \u003ca href='https://telegram.org/'\u003etext_link\u003c/a\u003e \u003cspan\u003ecustom_emoji | \u003cb\u003eEMOJI ID:12345\u003c/b\u003e\u003c/span\u003e \u003cspan\u003etext_mention: First Name | \u003cb\u003eID:9876543210\u003c/b\u003e\u003c/span\u003e\",\n  entities: [\n    { offset: 6, length: 45, type: 'mention' },\n    { offset: 52, length: 64, type: 'hashtag' },\n    { offset: 88, length: 24, type: 'bold' },\n    { offset: 117, length: 4, type: 'cashtag' },\n    { offset: 122, length: 15, type: 'bot_command' },\n    { offset: 138, length: 55, type: 'url' },\n    { offset: 194, length: 72, type: 'email' },\n    { offset: 267, length: 49, type: 'phone_number' },\n    { offset: 317, length: 26, type: 'bold' },\n    { offset: 344, length: 18, type: 'italic' },\n    { offset: 363, length: 12, type: 'underline' },\n    { offset: 375, length: 34, type: 'underline' },\n    { offset: 378, length: 22, type: 'bold' },\n    { offset: 410, length: 35, type: 'strikethrough' },\n    { offset: 446, length: 50, type: 'spoiler' },\n    {\n      offset: 530,\n      length: 45,\n      type: 'text_link',\n      url: 'https://telegram.org/',\n    },\n    {\n      offset: 576,\n      length: 49,\n      type: 'custom_emoji',\n      custom_emoji_id: '12345',\n    },\n    {\n      offset: 626,\n      length: 60,\n      type: 'text_mention',\n      user: {\n        id: 9876543210,\n        is_bot: false,\n        first_name: 'First Name',\n      },\n    },\n  ]\n}\n*/\n```\n\n### Custom transformer\n\n```js\nimport formatText, { htmlFormatters } from 'telegram-transformer';\nimport { MessageEntity } from 'typegram';\n\nconst text = 'Hello @username #awesome_hashtag';\nconst entities: MessageEntity[] = [\n  { offset: 6, length: 9, type: 'mention' },\n  { offset: 16, length: 16, type: 'hashtag' },\n];\n\nconst formatters = {\n  mention: (entityText: string, entity: MessageEntity, text: string) =\u003e ({\n    before: '\u003cawesome-mention\u003e',\n    after: '\u003c/awesome-mention\u003e',\n    text: entityText,\n  }),\n  hashtag: (entityText: string, entity: MessageEntity, text: string) =\u003e ({\n    before: '\u003cspan class=\"hashtag\"\u003e',\n    after: '\u003c/span\u003e',\n    text: entityText,\n  }),\n};\n\nconst formatted = formatText(text, entities, { formatters });\n\nconsole.log(formatted);\n\n/*\n{\n  text: 'Hello \u003cawesome-mention\u003e@username\u003c/awesome-mention\u003e \u003cspan class=\"hashtag\"\u003e#awesome_hashtag\u003c/span\u003e',\n  entities: [\n    { offset: 6, length: 44, type: 'mention' },\n    { offset: 51, length: 45, type: 'hashtag' }\n  ]\n}\n*/\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanodintsov%2Ftelegram-transformer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivanodintsov%2Ftelegram-transformer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanodintsov%2Ftelegram-transformer/lists"}