{"id":15523952,"url":"https://github.com/kpavlov/twilio-mock","last_synced_at":"2025-04-23T07:22:10.460Z","repository":{"id":41838499,"uuid":"456007841","full_name":"kpavlov/twilio-mock","owner":"kpavlov","description":"Twilio Mock API Server","archived":false,"fork":false,"pushed_at":"2025-03-23T20:47:58.000Z","size":613,"stargazers_count":7,"open_issues_count":4,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-23T21:31:06.456Z","etag":null,"topics":["emulator","mock-server","simulator","twilio-api"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kpavlov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2022-02-05T23:10:37.000Z","updated_at":"2025-03-23T20:47:36.000Z","dependencies_parsed_at":"2023-02-08T01:47:09.909Z","dependency_job_id":null,"html_url":"https://github.com/kpavlov/twilio-mock","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/kpavlov%2Ftwilio-mock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kpavlov%2Ftwilio-mock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kpavlov%2Ftwilio-mock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kpavlov%2Ftwilio-mock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kpavlov","download_url":"https://codeload.github.com/kpavlov/twilio-mock/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250387472,"owners_count":21422144,"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":["emulator","mock-server","simulator","twilio-api"],"created_at":"2024-10-02T10:48:05.097Z","updated_at":"2025-04-23T07:22:10.431Z","avatar_url":"https://github.com/kpavlov.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Twilio Mock API Server\n\n[![CircleCI](https://circleci.com/gh/kpavlov/twilio-mock/tree/master.svg?style=svg)](https://circleci.com/gh/kpavlov/twilio-mock/tree/master)\n\nTwilio API Simulator\n\n[![](http://www.plantuml.com/plantuml/svg/NP2n2i8m48RtUugZBYu5PwUAiqw-G8X73LulHt95GNnt6wBGE7x_dtpvoP3D9Pid1aZapSd8X4uLNu3euwHHI0mFgXoyin2boI-Fm24UEHJ0ZJgcCH49l5Uwhfv2ccPs5bFt9p-FGPvDyhjnYlxUeSjOkU1YXjKQxDiDUvmpGHFrsrrVtrZQcvbcg5IAbVdR0Wmar_8Z7m00)](docs/diagram.puml)\n\n## Setup\n\nDefine host name for `local` Twilio region. Your server will be running on `localhost:443` with self-signed TLS\ncertificate.\n\n```shell\necho '127.0.0.1 api.local.twilio.com' | sudo tee -a /etc/hosts\necho '127.0.0.1 conversations.local.twilio.com' | sudo tee -a /etc/hosts\necho '127.0.0.1 tsock.local.twilio.com' | sudo tee -a /etc/hosts\n```\n\n_.env_ file:\n\n```dotenv .env\nNODE_TLS_REJECT_UNAUTHORIZED=0 # Allow self-signed certificates\n```\n\nRunning server:\n\n```shell\n# Build\nyarn \u0026\u0026 yarn build\n\n# Start Nginx\nyarn proxy\n\n# Start Twilio API Mock server\nyarn start:prod\n```\n\nCalling API:\n\n```typescript\n// sample.ts\nimport {Twilio} from \"twilio\";\nimport dotenv from 'dotenv'\n\n// Load environment variables\ndotenv.config()\n\n// Twilio Credentials\nconst accountSid = process.env.ACCOUNT_SID; // Your Account SID from www.twilio.com/console\nconst authToken = process.env.AUTH_TOKEN; // Your Auth Token from www.twilio.com/console\n\nconst client = new Twilio(accountSid, authToken, {\n  region: 'local', // will connect to '*.local.twilio.com' === 127.0.0.1\n  logLevel: 'info' // or 'debug'\n})\nconst conversationsClient = client.conversations;\n\n// Use Twilio API as usual\nconst result = await conversationsClient.conversations.create()\nconsole.log('Created Conversation:', result)\n```\n\nTwilio client will get a dummy response from the mock server. This is the sample output:\n\n```log\nCreated Conversation: {\n  accountSid: 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',\n  chatServiceSid: 'ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',\n  messagingServiceSid: 'MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',\n  sid: 'CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',\n  friendlyName: 'Friendly Conversation',\n  uniqueName: 'unique_name',\n  attributes: { topic: 'feedback' },\n  state: 'inactive',\n  dateCreated: 2015-12-16T22:18:37.000Z,\n  dateUpdated: 2015-12-16T22:18:38.000Z,\n  timers: {\n    date_inactive: '2015-12-16T22:19:38Z',\n    date_closed: '2015-12-16T22:28:38Z'\n  },\n  url: 'https://conversations.twilio.com/v1/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',\n  links: {\n    participants: 'https://conversations.twilio.com/v1/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Participants',\n    messages: 'https://conversations.twilio.com/v1/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages',\n    webhooks: 'https://conversations.twilio.com/v1/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks'\n  },\n  bindings: {}\n}\n```\n\n**Note:**\nConfiguring [SSL](https://medium.com/@nitinpatel_20236/how-to-create-an-https-server-on-localhost-using-express-366435d61f28):\n\n```shell\nopenssl req -x509 -newkey rsa:2048 -keyout keytmp.pem -out cert.pem -days 36525\nopenssl rsa -in keytmp.pem -out key.pem\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkpavlov%2Ftwilio-mock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkpavlov%2Ftwilio-mock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkpavlov%2Ftwilio-mock/lists"}