{"id":17340687,"url":"https://github.com/s-soroosh/chatopia","last_synced_at":"2025-04-14T19:06:52.942Z","repository":{"id":52534845,"uuid":"205160026","full_name":"s-soroosh/chatopia","owner":"s-soroosh","description":null,"archived":false,"fork":false,"pushed_at":"2021-04-26T19:34:11.000Z","size":11353,"stargazers_count":16,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T19:06:43.149Z","etag":null,"topics":["chatbot","hacktoberfest","telegram"],"latest_commit_sha":null,"homepage":"","language":"Java","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/s-soroosh.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}},"created_at":"2019-08-29T12:33:56.000Z","updated_at":"2024-08-12T19:52:28.000Z","dependencies_parsed_at":"2022-09-22T16:02:15.103Z","dependency_job_id":null,"html_url":"https://github.com/s-soroosh/chatopia","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s-soroosh%2Fchatopia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s-soroosh%2Fchatopia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s-soroosh%2Fchatopia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s-soroosh%2Fchatopia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/s-soroosh","download_url":"https://codeload.github.com/s-soroosh/chatopia/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248943456,"owners_count":21186958,"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":["chatbot","hacktoberfest","telegram"],"created_at":"2024-10-15T15:46:08.540Z","updated_at":"2025-04-14T19:06:52.922Z","avatar_url":"https://github.com/s-soroosh.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[ ![Download](https://api.bintray.com/packages/psycho-ir/chatopia/chatopia-core/images/download.svg) ](https://bintray.com/psycho-ir/chatopia/chatopia-core/_latestVersion)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/44887b8a94d344b19f2f24f85228496d)](https://www.codacy.com/manual/soroosh.sarabadani/chatbot-core?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=psycho-ir/chatbot-core\u0026amp;utm_campaign=Badge_Grade)\n\nChatopia\n======= \n\nA framework to build chatbot compatible with different platforms!\nThe idea is simple, develop chatbots in the same way do implement web applications via Spring Web.\n\nA simple Example:\n\nHow to implement a chatbot able to echo the messages\n------------------------------------------------\n```java\n\npublic class MessageEchoExample {\n\n    @OnCommand(value = \"echo\", help = \"This command echo\")\n    public Response onEchoCommand(Command command, Context context) {\n        return Response.asText(\"echo \" + command.name());\n    }\n    // space star at the end of command name let arguments in\n    @OnCommand(value = \"echo *\", help = \"This command echo\")\n    public Response onEchoStarCommand(Command command, Context context) {\n        return Response.asText(command.name().substring(5));\n    }\n    \n}\n```\n`@OnEvent` annotation case be used in order to perform an action based \non events in the group. Example below demonstrates how to implement a welcome message for new members.\n```java\n    @OnEvent(\"NEW_CHAT_MEMBER\")\n    public Response onNewMember(Event\u003cUserEventPayload\u003e event, Context context) {\n        return Response.asText(\"Khosh oomadi lanati %s!\".formatted(event.getPayload().getFirstName()));\n    }\n```  \n\n![alt text](Chatopia.png \"Logo Title Text 1\")\n\nMilestones\n----------\nBelow are some ideas I'll implement in the comming days, no promise to respect the order though!\n\n-   [ ]  Design chatbot connector ready to implement for different platforms\n-   [ ]  Telegram Chatbot connector \n-   [ ]  Google chat Chatbot connector \n-   [ ]  Slack chatbot connector\n-   [ ]  Design plugin to make the chatbot extensible\n-   [ ]  Some plugins out of the box\n-   [ ]  List supported events\n\nHow to run examples\n-----------\nTo test the example you need to run the shell script called `set_telegram_webhook.sh` in root folder\nfollowing steps might be needed:  \n1.  Install `jq`. jq is a lightweight and flexible command-line JSON processor:  \n\t- on Ubuntu:`sudo apt install jq`  \n\t- on mac:`sudo brew install jq`  \n\t- doc and other options: [here](https://stedolan.github.io/jq/) \n  \n2.  Install `ngrok`:cross-platform application that enables developers to expose a local development server to the Internet with minimal effort:  \n\t- download `ngrok*.zip` from: [here](https://ngrok.com/download)\n\t- unzip downloaded file: `unzip*.zip`\n\t- log in to website\n\t- set your token:`./ngrok authtoken \u003cyour_auth_token\u003e`\n\t- move it to bin:`sudo mv ngrok /usr/local/bin`\n\t- check if everything works fine by this command:`ngrok http 80`  \n  \n3. Get your currently existing bot API from telegrams [botfather](www.T.me/BotFather) or create one.  \n\n4. Once you have your API Key ready, run this script. Replace TELEGRAM_API_KEY with your API Key:\n\t- set API key in: `resources/application.yml`  \n\t- `./set_telegram_webhook.sh 8080 /connectors/telegram TELEGRAM_API_KEY`\n\n5. If everything is fine you will see:  \n\t`{\"ok\":true,\"result\":true,\"description\":\"Webhook is already set\"}`  \n6. Send a simple `hi` message to your bot to check if its working. have fun.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs-soroosh%2Fchatopia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fs-soroosh%2Fchatopia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs-soroosh%2Fchatopia/lists"}