{"id":15816621,"url":"https://github.com/farmbot/farmbot-js","last_synced_at":"2025-04-06T03:09:44.288Z","repository":{"id":46031299,"uuid":"46863767","full_name":"FarmBot/farmbot-js","owner":"FarmBot","description":"Javascript wrapper for FarmBot's authentication and RPC instructions","archived":false,"fork":false,"pushed_at":"2024-01-19T23:01:57.000Z","size":6762,"stargazers_count":115,"open_issues_count":0,"forks_count":81,"subscribers_count":19,"default_branch":"main","last_synced_at":"2025-04-02T16:52:19.976Z","etag":null,"topics":["farmbot"],"latest_commit_sha":null,"homepage":"","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/FarmBot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-11-25T13:37:52.000Z","updated_at":"2025-03-21T13:25:59.000Z","dependencies_parsed_at":"2023-02-09T13:15:34.018Z","dependency_job_id":"77de7f33-614a-46eb-874e-1617b9aca30b","html_url":"https://github.com/FarmBot/farmbot-js","commit_stats":{"total_commits":768,"total_committers":8,"mean_commits":96.0,"dds":0.12109375,"last_synced_commit":"a2f3bbfd0db3da3818d094889520c43d3c2637a2"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FarmBot%2Ffarmbot-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FarmBot%2Ffarmbot-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FarmBot%2Ffarmbot-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FarmBot%2Ffarmbot-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FarmBot","download_url":"https://codeload.github.com/FarmBot/farmbot-js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247427006,"owners_count":20937201,"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":["farmbot"],"created_at":"2024-10-05T05:06:11.058Z","updated_at":"2025-04-06T03:09:44.270Z","avatar_url":"https://github.com/FarmBot.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm](https://img.shields.io/npm/v/farmbot)](https://www.npmjs.com/package/farmbot?activeTab=versions)\n[![ci](https://github.com/FarmBot/farmbot-js/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/FarmBot/farmbot-js/actions?query=branch%3Amain)\n[![Coverage Status](https://coveralls.io/repos/github/FarmBot/farmbot-js/badge.svg?branch=main)](https://coveralls.io/github/FarmBot/farmbot-js?branch=main)\n\n# FarmbotJS: Farmbot RPC wrapper\n\n## Browser Support\n\nWorks on all _modern_ browsers that were released in the last 12 months.\n\n## NodeJS Support\n\nIndependent developers have reported success when using FarmBotJS in a Node environment, but we do not test against Node based setups, nor do we (FarmBot, Inc) use FarmBotJS in a production Node environment. Issue reports related to NodeJS are highly appreciated.\n\n## Installation (NPM)\n\n```bash\nnpm install farmbot\n```\n\n## Installation (Vanilla JS)\n\n```\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/farmbot@latest/dist/farmbot_single_file.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  var farmbot123 = new fbjs.Farmbot({ token: \"foo.bar.baz\" });\n\u003c/script\u003e\n```\n\n## Running the Test Suite (Advanced)\n\n\n```bash\nnpm run test\n```\n\n## Other Package Managers\n\nPlease raise an issue if you require support with other package managers.\n\n## Login with an API Token\n\nLogin using your API token from the [Farmbot Web App](http://my.farm.bot).\n\n[Click here for instructions on how to generate an API token.](https://developer.farm.bot/docs/rest-api#section-generating-an-api-token)\n\n### Example:\n\n```javascript\n\nimport { Farmbot } from \"farmbot\";\n\nvar SUPER_SECRET_TOKEN = \"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTIzQHRlc3QuY29tIiwiaWF0IjoxNDU5MTA5NzI4LCJqdGkiOiI5MjJhNWEwZC0wYjNhLTQ3NjctOTMxOC0xZTQxYWU2MDAzNTIiLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjMwMDAvIiwiZXhwIjoxNDU5NDU1MzI4LCJtcXR0IjoibG9jYWxob3N0IiwiYm90IjoiYWE3YmIzN2YtNWJhMy00NjU0LWIyZTQtNThlZDU3NDY1MDhjIn0.KpkNGR9YH68AF3iHP48GormqXzspBJrDGm23aMFGyL_eRIN8iKzy4gw733SaJgFjmebJOqZkz3cly9P5ZpCKwlaxAyn9RvfjQgFcUK0mywWAAvKp5lHfOFLhBBGICTW1r4HcZBgY1zTzVBw4BqS4zM7Y0BAAsflYRdl4dDRG_236p9ETCj0MSYxFagfLLLq0W63943jSJtNwv_nzfqi3TTi0xASB14k5vYMzUDXrC-Z2iBdgmwAYUZUVTi2HsfzkIkRcTZGE7l-rF6lvYKIiKpYx23x_d7xGjnQb8hqbDmLDRXZJnSBY3zGY7oEURxncGBMUp4F_Yaf3ftg4Ry7CiA\";\n\nlet bot = new Farmbot({ token: SUPER_SECRET_TOKEN });\n\nbot\n  .connect()\n  .then(function () {\n    return bot.moveRelative({ x: 1, y: 2, z: 3, speed: 100 });\n  });\n\n```\n\n# Sending Commands to a Farmbot Object\n\n```javascript\n\nbot\n  .connect()\n  .then(function(bot){\n    console.log(\"Bot online!\");\n    return bot.emergencyStop(); // You can chain commands.\n  })\n  .then(function(bot){\n    console.log(\"Bot has stopped!\");\n  })\n  .catch(function(error) {\n    console.log(\"Something went wrong :(\");\n  });\n\n```\n\n## Basic RPC Commands\n\nCall RPC commands using the corresponding method on `bot`. All RPC commands return a promise.\n\n### Example:\n\n```javascript\n\nbot\n  .home({ axis: \"x\", speed: 800 })\n  .then(function (ack) {\n    console.log(\"X Axis is now at 0.\");\n  })\n  .catch(function (err) {\n    console.log(\"Failed to bring X axis home.\");\n  })\n\n```\n\n### Currently supported commands:\n\n[See the annotated type definitions for available methods and properties.](https://github.com/FarmBot/farmbot-js/blob/main/dist/farmbot.d.ts)\n\n## Using Events\n\n```javascript\n  var bot = Farmbot({ token: '---'});\n  bot.on(\"eventName\", function(data, eventName) {\n    console.log(\"I just got an\" + eventName + \" event!\");\n    console.log(\"This is the payload: \" + data);\n  })\n   // \"I just got an eventName event!\"\n   // \"This is the payload: any javascript object or primitive\"\n  bot.emit(\"eventName\", \"any javascript object or primitive\");\n  var eventHandlers = bot.event(\"eventName\");\n   // [function(){...}]\n```\n\n## Routine Events\n\n * `\"status\"`: Most important. When the REMOTE device state changes (eg: \"x\" goes from 0 to 100), the bot will emit this event.\n * `\"logs\"`: The bot will send logs to this channel.\n * `\"offline\"`: Connection lost. **Note: FarmbotJS will try to auto-reconnect**.\n * `\"online\"`: Client is connected and subscribed to bot.\n * `\"sent\"`: Triggered when the application begins sending a message.\n * `\"sync\"`: A resource on the API has changed.\n\n## Special Events\n\n * `\u003crandom uuid\u003e`: RPC commands have UUIDs when they leave the browser. When the bot responds to that message, FarmbotJS will emit an event named after the request's UUID. Mostly for internal use.\n * `\"malformed\"`: When the bot gets a bad RPC command, it will notify you via this channel.\n * `*`: Catch all events (for debugging).\n\n# Q: Where do I report security issues?\n\nWe take security seriously and value the input of independent researchers. Please see our [responsible disclosure guidelines](https://farm.bot/responsible-disclosure-of-security-vulnerabilities/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarmbot%2Ffarmbot-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffarmbot%2Ffarmbot-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarmbot%2Ffarmbot-js/lists"}