{"id":22379246,"url":"https://github.com/metaphysics0/accountability-texter","last_synced_at":"2025-03-26T19:13:35.015Z","repository":{"id":265850887,"uuid":"629327717","full_name":"Metaphysics0/accountability-texter","owner":"Metaphysics0","description":"Hold yourself accountable yo","archived":false,"fork":false,"pushed_at":"2023-05-20T15:00:05.000Z","size":1725,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-24T09:54:25.762Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://accountability-texter.vercel.app","language":"Svelte","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/Metaphysics0.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-04-18T05:08:55.000Z","updated_at":"2023-04-22T09:19:45.000Z","dependencies_parsed_at":"2024-12-01T08:16:03.251Z","dependency_job_id":"70582f79-620b-4246-927e-4ccaf6f2ca0d","html_url":"https://github.com/Metaphysics0/accountability-texter","commit_stats":null,"previous_names":["metaphysics0/accountability-texter"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Metaphysics0%2Faccountability-texter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Metaphysics0%2Faccountability-texter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Metaphysics0%2Faccountability-texter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Metaphysics0%2Faccountability-texter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Metaphysics0","download_url":"https://codeload.github.com/Metaphysics0/accountability-texter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245718777,"owners_count":20661161,"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-12-04T23:09:24.476Z","updated_at":"2025-03-26T19:13:34.977Z","avatar_url":"https://github.com/Metaphysics0.png","language":"Svelte","funding_links":[],"categories":[],"sub_categories":[],"readme":"# accountability-texter\n\n## Developing\n\nOnce you've created a project and installed dependencies with `npm install`\n\n```bash\nnpm run dev\n\n# or start the server and open the app in a new browser tab\nnpm run dev -- --open\n```\n\n## Building\n\nTo create a production version of your app:\n\n```bash\nnpm run build\n```\n\nYou can preview the production build with `npm run preview`.\n\n# How it works:\n\n1. after a user signs up, we store a simple document of their transaction in a mongo collection\n   The document will look like this:\n\n```javascript\ninterface IUser {\n  id: BSON::ObjectId(...),\n  purchaseDate: new Date().now,\n  purchaserLocation: { lat, lng ...}, // the location of the purchaser\n  goal: string,\n  goalTargetDate: Date(),\n  messageFrequency: 1 | 2 | 3,\n  phoneNumber: number\n}\n```\n\n2. A cloudflare worker function runs every hour, grabs the collection of all users, and calls twilio to send the message to all the relevant recipients\n   The worker function grabs the whole mongo collection, and checks if they fall into the relative time frame of the current worker's location.\n   If so, we trigger a twilio message to the users's phone number\n\ni.e.\n\n```javascript\nworker.ts;\n\nasync function sendMessageToAllUsers() {\n\tconst relevantUsers = db.users.where({\n\t\tgoalTargetDate: {\n\t\t\tlessThan: now\n\t\t}\n\t});\n\n\trelevantUsers.forEach(sendMessageToUser);\n}\n\nasync function sendMessageToUser(user: IUser) {\n\tconst phoneNumber = user.phoneNumber;\n\ttwilioClient.sendSms({\n\t\tto: phoneNumber,\n\t\tfrom: TWILIO_FROM_PHONE_NUMBER,\n\t\tbody: createMessageFromGoal(user.goal)\n\t});\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetaphysics0%2Faccountability-texter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmetaphysics0%2Faccountability-texter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetaphysics0%2Faccountability-texter/lists"}