{"id":20834777,"url":"https://github.com/promptable/twilio-gpt-sms","last_synced_at":"2025-05-08T02:06:05.111Z","repository":{"id":65424895,"uuid":"577015188","full_name":"promptable/twilio-gpt-sms","owner":"promptable","description":"Twilio GPT SMS Chat Bot","archived":false,"fork":false,"pushed_at":"2023-01-01T21:14:56.000Z","size":55,"stargazers_count":74,"open_issues_count":2,"forks_count":106,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-05-08T02:03:55.034Z","etag":null,"topics":["chatbot","chatgpt","gpt","gpt3","openai","sms","twilio"],"latest_commit_sha":null,"homepage":"https://promptable.ai","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/promptable.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":"2022-12-11T18:00:43.000Z","updated_at":"2025-04-28T18:53:44.000Z","dependencies_parsed_at":"2023-02-01T01:01:39.028Z","dependency_job_id":null,"html_url":"https://github.com/promptable/twilio-gpt-sms","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/promptable%2Ftwilio-gpt-sms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/promptable%2Ftwilio-gpt-sms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/promptable%2Ftwilio-gpt-sms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/promptable%2Ftwilio-gpt-sms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/promptable","download_url":"https://codeload.github.com/promptable/twilio-gpt-sms/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252983760,"owners_count":21835764,"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","chatgpt","gpt","gpt3","openai","sms","twilio"],"created_at":"2024-11-18T00:20:46.391Z","updated_at":"2025-05-08T02:06:04.715Z","avatar_url":"https://github.com/promptable.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GPT3 SMS Bot Starter Kit\n \nGPT3 SMS Bot Starter Kit using Twilio. Based on this [tutorial](https://www.twilio.com/blog/sms-stocks-bot-twilio-typescript).\n\n## Running this project\n\n### Things you will need\n\n* [Node.js](https://nodejs.org/en/) installed on your machine\n* A Twilio account (if you don't have one yet, [sign up for a free Twilio account here and receive $10 credit when you upgrade](https://twil.io/philnash))\n* A Twilio phone number that can receive SMS messages\n* [ngrok](https://ngrok.com/) so that you can [respond to webhooks in your local development environment](https://www.twilio.com/blog/2015/09/6-awesome-reasons-to-use-ngrok-when-testing-webhooks.html)\n* (Optional) A [Promptable](https://promptable.ai) account for creating / managing prompts.\n* (Optional) A Fly.io account for deploying the app\n\n\n### Create a Twilio Account / Phone Number\n\nBased on this [tutorial](https://www.twilio.com/blog/sms-stocks-bot-twilio-typescript). After your account is created, use this command to create a phone number that can receive SMS messages:\n\n```\ntwilio phone-numbers:update PHONE_NUMBER --sms-url https://RANDOM_STRING.ngrok.io/messages\n```\n\nYou'll need the Twilio CLI installed. You'll need to \"upgrade\" to paid if you want to remove the Twilio branding from the SMS replies.\n\n### Dependencies\n\nInstall the dependencies:\n\n```bash\nnpm install\n```\n\n### Environment Variables\n\nCopy the `.env.example` file to `.env`:\n\n```bash\ncp .env.example .env\n```\n\nFill in your TWILIO and OPENAI Keys, and your personal PHONE_NUMBER.\n\n### Compile the TypeScript to JavaScript\n\nCompile the project:\n\n```bash\nnpm run build\n```\n\nNote that this runs the TypeScript compiler, `tsc`, you could also run `npx tsc` to get the same output.\n\nThe TypeScript project will be compiled into the `dist` directory. You can also continuously compile the project as it changes with:\n\n```bash\nnpm run watch\n```\n\n### Run the project\n\nStart the web server with:\n\n```bash\nnpm start\n```\n\n### Expose the local server with ngrok\n\nTo respond to an incoming webhook you will need a publicly available URL. [ngrok](https://ngrok.com) is a tool that can tunnel through from a public URL to your machine. Once you've [downloaded and installed ngrok](https://ngrok.com/download) you can run it like so:\n\n```bash\nngrok http 3000\n```\n\nThe ngrok terminal will show you a URL, like `https://RANDOM_STRING.ngrok.io`.\n\n### Connect your phone number to your app\n\nUsing the ngrok URL from the last part, you can set up your Twilio phone number with your application. [Edit your phone number](https://www.twilio.com/console/phone-numbers/incoming) and in the Messaging section, next to when \"A message comes in\" enter your ngrok URL with the path `/messages`.\n\n```\nhttps://RANDOM_STRING.ngrok.io/messages\n```\n\nSave the phone number and you are ready. Send your number a message and receive a reply. Type \"reset\" to reset the chat thread history and bdeing again.\n\n## Deploy with FLy.io\n\n```\nfly launch (if it's the first time)\n# update fly.toml internal port to 3000\nfly deploy\n# Set your secrets from .env\nfly secrets set --app gpt3-chat TWILIO_ACCOUNT_SID= TWILIO_AUTH_TOKEN= TWILIO_PHONE_NUMBER= OPENAI_API_KEY=\n```\n\n## GPT3 Example Integration\n\n```ts\nconst { Configuration, OpenAIApi } = require(\"openai\");\n\nconst configuration = new Configuration({\n  apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\n\nconst response = await openai.createCompletion({\n  model: \"text-davinci-003\",\n  prompt: \"Please reply to the chat below:\\n\",\n  temperature: 0.7,\n  max_tokens: 256,\n  top_p: 1,\n  frequency_penalty: 0,\n  presence_penalty: 0,\n});\n```\n\n## Promptable Integration\nTo get started using Promptable to create and fetch your prompts, go to https://promptable.ai!\n\nThen, create and deploy a prompt and fetch it like this\n```\nconst { data } = await axios.get(`https://promptable.ai/api/prompt/\u003cYOUR PROMPT ID HERE\u003e/deployment/active`);\nconst { text, configs } = data // get your prompt text and configs\n//... now use it in the chat bot!\n```\n\n## Other\n\nGet sms messages on your mac.\nhttps://support.apple.com/guide/messages/get-sms-texts-from-iphone-on-your-mac-icht8a28bb9a/mac\n\n## TODOs/ Feature Requests\n\nTODO: Add Voice Chats:\n- https://www.twilio.com/docs/voice/twiml/say/text-speech\n- https://www.twilio.com/blog/programmable-voice-javascript-quickstart-demo-node\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpromptable%2Ftwilio-gpt-sms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpromptable%2Ftwilio-gpt-sms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpromptable%2Ftwilio-gpt-sms/lists"}