{"id":15669079,"url":"https://github.com/kopiro/whatever2telegram","last_synced_at":"2025-09-01T04:38:20.257Z","repository":{"id":38732413,"uuid":"232642692","full_name":"kopiro/whatever2telegram","owner":"kopiro","description":"Allows forwarding whatever you want to a Telegram handle.","archived":false,"fork":false,"pushed_at":"2024-06-11T22:41:55.000Z","size":444,"stargazers_count":9,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-25T17:44:24.193Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kopiro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2020-01-08T19:33:19.000Z","updated_at":"2023-03-08T05:05:29.000Z","dependencies_parsed_at":"2023-11-12T13:27:09.845Z","dependency_job_id":"e81574fd-deed-4b95-a93b-e6b55713a35e","html_url":"https://github.com/kopiro/whatever2telegram","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kopiro%2Fwhatever2telegram","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kopiro%2Fwhatever2telegram/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kopiro%2Fwhatever2telegram/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kopiro%2Fwhatever2telegram/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kopiro","download_url":"https://codeload.github.com/kopiro/whatever2telegram/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242819321,"owners_count":20190425,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-10-03T14:21:27.633Z","updated_at":"2025-03-10T08:31:54.964Z","avatar_url":"https://github.com/kopiro.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# whatever2telegram\n\nAllows forwarding whatever you want to a Telegram handle (chat, group or channel).\n\nEvery module is built in a way that its job is just to fetch data, without caring of sending the actual messages, excluding previous data or data formatting.\n\nThe list of elements are configured in the `./data/config.js` file\n\nTop-level options are:\n\n- `env`: environment string\n- `sentryDsn`: DNS used for Sentry error reporting\n- `telegram`:\n  - `token`: token of your bot\n  - `polling`: enable polling to fetch data\n- `doNotDisturb`:\n  - `min`: hour of the day (24h) before which modules are not called\n  - `max`: hour of the day (24h) after which modules are not called\n\nExample configuration:\n\n```js\nmodule.exports = {\n  env: \"prod\",\n  sentryDsn: \"\",\n  telegram: {\n    token: \"\",\n  },\n  doNotDisturb: {\n    min: 7,\n    max: 23,\n  },\n  modules: [\n    {\n      description: \"MyRSS\",\n      chatIds: [\"@MyRSS\"],\n      name: \"rss\",\n      args: {\n        url: \"https://yourwebsite.com/rss\",\n      },\n      fetchInterval: 60 * 10,\n    },\n    {\n      description: \"MyJSON\",\n      chatIds: [\"@MyJSON\"],\n      name: \"json\",\n      args: {\n        url: \"http://myjson.com\",\n      },\n      mapper: data =\u003e data.result.filter(e =\u003e e.location === \"Stockholm\").map(e =\u003e ({ ...e, hash: e.event_id })),\n      formatters: [\n        e =\u003e ({\n          message: \"\u003cb\u003e${e.title} at ${e.date}\u003cb\u003e\",\n          photo: e.event_image,\n          url: `https:${e.url}`,\n        }),\n      ],\n      fetchInterval: 60,\n    },\n  ],\n};\n```\n\n## Modules\n\nA module is an encapsulated piece of logic to grab data from a source.\n\nAvailable options to every module:\n\n- `chatIds`: array of Telegram chat ids\n- `fetchInterval`: how often (in seconds) data should be fetched\n- `name`: name of the module\n- `args`: arguments to pass to the modules\n- `description`: unique identifier for this configuration\n- `formatters[]?`: list of _formatters_ to apply in sequence\n\n#### `mapper`\n\nThe `mapper` attribute is a JS function to invoke to parse the response and return an array of elements.\n\nThis function can filter and only returns attributes of your element that you want to diff against previous runs,\nto understand to process the element or not.\n\nIf the mapper returns an `hash` attribute, the check against the attributes will be skipped and `hash` will be used instead.\n\n### `facebook_page`\n\nFacebook page posts.\n\n- `pageId`: Facebook page-id\n- `accessToken`: Extended access token\n\n### `json`\n\nURL endpoint with JSON data formatting.\n\n- `url`: URL to fetch\n- `headers?`: HTTP headers\n\n### `rss`\n\nURL endpoint with RSS data formatting.\n\n- `url`: URL to fetch\n\n### `visual`\n\nURL endpoint and checks a visual diff of a specific DOM element\n\n- `url`: URL to fetch\n- `element_selector?`: DOM selector that will be visuall diffed\n- `click_selector?`: DOM selector to click before taking screenshot\n\n## Formatters\n\nA formatter is a function that receives your output before being sent to be able to manipulate it.\n\nYou can define a formatter with:\n\n- a string (the name of formatter)\n- an object like `{ \"name\": \"__NAME__\", \"options\": {} }`\n- a custom JS function\n\nAvailable formatters:\n\n### `translate`\n\nTranslate the input message.\n\n- `mode`: `replace`, `append` or `prepend`, default: `replace`\n- `toLanguage`: language to translate to, default: `en`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkopiro%2Fwhatever2telegram","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkopiro%2Fwhatever2telegram","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkopiro%2Fwhatever2telegram/lists"}