{"id":18924673,"url":"https://github.com/neurotech-hq/sarufi-python-sdk","last_synced_at":"2025-10-07T19:54:34.187Z","repository":{"id":62592963,"uuid":"492287097","full_name":"Neurotech-HQ/sarufi-python-sdk","owner":"Neurotech-HQ","description":"Sarufi Python SDK to help you interact with Sarufi Conversational API","archived":false,"fork":false,"pushed_at":"2024-04-05T16:33:46.000Z","size":61,"stargazers_count":23,"open_issues_count":4,"forks_count":13,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-15T14:53:48.203Z","etag":null,"topics":["conversational-platform","sarufi","sarufi-sdk"],"latest_commit_sha":null,"homepage":"https://docs.sarufi.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Neurotech-HQ.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}},"created_at":"2022-05-14T17:50:30.000Z","updated_at":"2024-10-29T20:46:05.000Z","dependencies_parsed_at":"2025-04-15T12:50:28.732Z","dependency_job_id":null,"html_url":"https://github.com/Neurotech-HQ/sarufi-python-sdk","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/Neurotech-HQ/sarufi-python-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neurotech-HQ%2Fsarufi-python-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neurotech-HQ%2Fsarufi-python-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neurotech-HQ%2Fsarufi-python-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neurotech-HQ%2Fsarufi-python-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Neurotech-HQ","download_url":"https://codeload.github.com/Neurotech-HQ/sarufi-python-sdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neurotech-HQ%2Fsarufi-python-sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278838471,"owners_count":26054721,"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","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"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":["conversational-platform","sarufi","sarufi-sdk"],"created_at":"2024-11-08T11:07:45.816Z","updated_at":"2025-10-07T19:54:34.170Z","avatar_url":"https://github.com/Neurotech-HQ.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003csamp\u003e\n\n# sarufi-python-sdk\n\n[![Downloads](https://pepy.tech/badge/sarufi)](https://pepy.tech/project/sarufi)\n[![Downloads](https://pepy.tech/badge/sarufi/month)](https://pepy.tech/project/sarufi)\n[![Downloads](https://pepy.tech/badge/sarufi/week)](https://pepy.tech/project/sarufi)\n\nSarufi Python SDK to help you interact with SARUFI platform\n\n## Table of Contents\n- [Installation](#installation)  \n- [Authentication](#authentication)  \n- [Creating a Bot](#creating-a-bot)  \n    - [Creating a Bot from file](#creating-a-bot-from-file)  \n- [Updating bot](#updating-bot)     \n    - [Update a bot from file](#update-a-bot-from-file)  \n- [Using it in a conversation](#using-it-in-a-conversation)    \n    - [Get a bot](#get-a-bot)  \n- [Deleting a bot](#deleting-a-bot) \n\n## Installation\n\nMake sure you have [sarufi package](https://github.com/Neurotech-HQ/sarufi-python-sdk) installed on your machine before launching your telegram bot, you can easily install by the following command;\n\n```bash\ngit clone https://github.com/Neurotech-HQ/sarufi-python-sdk\ncd sarufi-python-sdk\nsarufi-python-sdk $ python setup.py install\n```\n\n## Authentication\n\nTo authenticate you're bot, you have to specify your client_id and client_secret for Sarufi Platform just as shown below;\n\n```python\n\u003e\u003e\u003e from sarufi import Sarufi\n\u003e\u003e\u003e sarufi = Sarufi(api_key='your API KEY')\n```\n\n## Creating a Bot\n\nTo create you're bot with sarufi, you have to be aware of two importants idea or concepts which is **intents** and **flow**.\n\nHere an example on how to create your bot;\n\n```python\nsarufi.create_bot(\n    name=\"Athony bot\",\n    description=\"My bot can do a lot\",\n    intents={\n        \"salamu\": [\"Mambo\", \"Hi\", \"Hello\", \"Niaje\"],\n        \"contact\": [\n            \"naomba mawasiliano\",\n            \"naomba number\",\n            \"naomba namba\",\n            \"nipe mawasiliano\",\n            \"nipe contact\",\n        ],\n    },\n    flow={\n        \"salamu\": {\"message\": [\"Hi\", \"Naimani upo salama\"], \"next\": \"end\"},\n        \"contact\": {\n            \"message\": [\"Ungependa kupata namba ya nani ?\"],\n            \"next_state\": \"chukua_namba\",\n        },\n        \"chukua_namba\": {\n            \"message\": [\"Namba ya huyo mtu ni 07374734737\", \"Karibu tena !!\"],\n            \"next_state\": \"end\",\n        },\n    },\n)\n```\n\n### Creating a Bot from file\n\nYou can create your bot from a file, Here is an example on how to create your bot from a file;\n\n```python\nfrom sarufi import Sarufi\n\nsarufi = Sarufi(api_key='your API KEY')\n\n\nif __name__ == \"__main__\":\n    response = sarufi.create_from_file(\n        intents=\"data/intents.yaml\",\n        flow=\"data/flows.yaml\",\n        metadata=\"data/metadata.yaml\",\n    )\n    print(response.data)\n```\n\n## Updating bot\n\nUpdating the bot is comparatively similar to creating a bot but this time you have to explicity specify the **project ID** of your bot.\n\n```python\nsarufi.update_bot(\n    name=\"Athony bot\",\n    description=\"My bot can do a lot\",\n    intents={\n        \"salamu\": [\"Mambo\", \"Hi\", \"Hello\", \"Niaje\"],\n        \"contact\": [\n            \"naomba mawasiliano\",\n            \"naomba number\",\n            \"naomba namba\",\n            \"nipe mawasiliano\",\n            \"nipe contact\",\n        ],\n    },\n    flow={\n        \"salamu\": {\"message\": [\"Hi\", \"Naimani upo salama\"], \"next\": \"end\"},\n        \"contact\": {\n            \"message\": [\"Ungependa kupata namba ya nani ?\"],\n            \"next_state\": \"chukua_namba\",\n        },\n        \"chukua_namba\": {\n            \"message\": [\"Namba ya huyo mtu ni 07374734737\", \"Karibu tena !!\"],\n            \"next_state\": \"end\",\n        },\n    },\n    id=2,\n)\n```\n\n### Update a bot from file\n\nYou can update your bot from a file as follows;\n\n```python\nfrom sarufi import Sarufi\n\nsarufi = Sarufi(api_key='your API KEY')\n\n\nif __name__ == \"__main__\":\n    response = sarufi.update_from_file(\n        id=5,\n        intents=\"data/intents.yaml\",\n        flow=\"data/flows.yaml\",\n        metadata=\"data/metadata.yaml\",\n    )\n    print(response.data)\n```\n\n## Using it in a conversation\n\nHere you have to know the bot ID and also specify your user unique ID;\n\n```python\n\u003e\u003e\u003e from sarufi import Sarufi\n\u003e\u003e\u003e sarufi = Sarufi(api_key='your API KEY')\n2022-08-23 18:30:32,918 - root - INFO - Getting token\n\u003e\u003e\u003e bots = sarufi.bots()\n2022-08-23 18:30:38,223 - root - INFO - Getting bots\n\u003e\u003e\u003e bots\n[Bot(id=4, name=iBank), Bot(id=5, name=Maria)]\n\u003e\u003e\u003e maria = bots[1]\n\u003e\u003e\u003e maria.respond('Hi')\n2022-08-23 18:30:52,065 - root - INFO - Sending message to bot and returning response\n2022-08-23 18:30:54,126 - root - INFO - Status code: 200\n2022-08-23 18:30:54,127 - root - INFO - Message sent successfully\n{'message': [['vipi uhali gani?'], ['umeshindaje?'], ['mzima wewe?'], ['Hello! u hali gani ?'], ['Freshi nambie ?'], ['Hi, mzima wewe'], ['salama sijui wewe'], ['za kwako?'], ['Vipi hali yako'], ['Uhali gani?']]}\n\u003e\u003e\u003e maria.respond(\"mi mzima wa afya\")\n2022-08-23 18:31:02,245 - root - INFO - Sending message to bot and returning response\n2022-08-23 18:31:04,237 - root - INFO - Status code: 200\n2022-08-23 18:31:04,237 - root - INFO - Message sent successfully\n{'message': [['Ninafurahi kujua uko salama'], ['nimefurahi kusikia kutoka kwako'], ['Nipo salama pia, nimefurahi kusikia kutoka kwako'], ['Napenda kukuona ukiwa na furaha'], ['Nimefurahi kusikia hivyo'], ['Salama kabisa'], ['Mzima kabisa']]}\n```\n\n### Get a bot\n\nQuery a bot by ID\n\n```python\n\u003e\u003e\u003e from sarufi import Sarufi\n\u003e\u003e\u003e sarufi = Sarufi(api_key='your API KEY')\n\u003e\u003e\u003e maria= sarufi.get_bot(5)\n2022-08-23 18:44:05,473 - root - INFO - Getting token\n\u003e\u003e\u003e maria\nBot(id=5, name=Maria)\n```\n\n## Deleting a bot\n\nDelete a bot by ID\n\n```python\n\u003e\u003e\u003e from sarufi import Sarufi\n\u003e\u003e\u003e sarufi = Sarufi(api_key='your API KEY')\n\u003e\u003e\u003e sarufi.delete_bot(5)\n```\n\n### Issues ?\n\nAre you facing any issue with the usage of the package, please raise one\n\n## Contributors\n\n1. [kalebu](https://github.com/kalebu/)\n2. [Anthony Mipawa](https://github.com/Tonyloyt)\n\u003c/samp\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneurotech-hq%2Fsarufi-python-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneurotech-hq%2Fsarufi-python-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneurotech-hq%2Fsarufi-python-sdk/lists"}