{"id":18045377,"url":"https://github.com/lance/telegram-demo","last_synced_at":"2025-08-18T15:31:38.598Z","repository":{"id":152881218,"uuid":"605293981","full_name":"lance/telegram-demo","owner":"lance","description":"Knative and Camel-K app which translates Telegram messages via Google Translate API","archived":false,"fork":false,"pushed_at":"2023-02-23T17:18:47.000Z","size":211,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-30T18:13:36.934Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/lance.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":"2023-02-22T21:22:39.000Z","updated_at":"2023-03-03T02:08:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"4cd21ca6-1de0-4a7d-bb11-7bbb1b39d0fc","html_url":"https://github.com/lance/telegram-demo","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/lance%2Ftelegram-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lance%2Ftelegram-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lance%2Ftelegram-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lance%2Ftelegram-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lance","download_url":"https://codeload.github.com/lance/telegram-demo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230245336,"owners_count":18196134,"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-30T18:13:01.277Z","updated_at":"2024-12-18T09:10:26.890Z","avatar_url":"https://github.com/lance.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Knative and Camel-K Telegram Translate Bot Example\n\nThis demo converts Telegram messages into English using Camel-K and Knative functions.\n\nIt uses a Camel-K Kamelet to periodically poll Telegram for messages.\nThe Kamelet converts each message into a CloudEvent, sending it to the default Knative\nBroker. A `translate` function receives these events via a `Trigger` between the\n`Broker` and the function which filters for these types of events.\n\nThe `translate` function uses the Google Translation API is used to convert the\nmessage text to English, and the result is returned to the broker as `data` in a new\ntranslation CloudEvent.\n\nThe broker has two additional triggers that respond to these translation events. One\nforwards the event to a `viewer` function, which simply displays the event on the\nconsole so that we can see if things are behaving as expected. The other trigger sends\nthe event to a `responder` function, which responds to the message in the Telegram\nchat with the translation.\n\n![System diagram](diagram.png \"system diagram\")\n\n## Prerequisites\n* A cluster with Knative installed\n* CamelK https://camel.apache.org/camel-k/1.9.x/installation/installation.html installed\n* Google Translation API key in `translate/service-account-file.json`\n* Update the Telegram API key in [./resources/telegram-binding-v1.yaml](resources/telegram-binding-v1.yaml)\n\n## Steps\n* Ensure your Google Translation API key is correctly set in `translate/service-account-file.json`\n* Create a Kubernetes secret containing your Telegram API key\n```\nkubectl create secret generic telegram --from-literal=API_KEY=\u003capikey\u003e\n```\n\n* Install a default Knative Broker\n```\nkn broker create default\n```\n\n* Deploy the functions\n```\nfunc deploy -p viewer\nfunc deploy -p translate\nfunc deploy -p responder\n```\n\n* Create the Telegram-\u003eTranslate trigger\n```\nkn trigger create telegram-trigger -s translate --filter type=telegram.source\n```\n\n* Create the Translation-\u003eViewer trigger\n```\nkn trigger create translate-trigger -s viewer --filter type=knative.function.translation\n```\n\n* Create the Translation-\u003eResponder trigger\n```\nkn trigger create responder-trigger -s responder --filter type=knative.function.translation\n```\n\n* Install the Kamelet\n```\nkubectl apply -f resources/telegram-binding-v1.yaml\n```\n\n* Send a Telegram message to your bot channel\n\n* Check the logs\n```\nk logs -l app=viewer -f\nk logs -l app=responder -f\nk logs -l app=translate -f\n```\n\n* Cleanup\n```\n./resources/teardown.sh\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flance%2Ftelegram-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flance%2Ftelegram-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flance%2Ftelegram-demo/lists"}