{"id":50562981,"url":"https://github.com/sentdm/twilio-message-export","last_synced_at":"2026-06-04T12:30:25.520Z","repository":{"id":360131227,"uuid":"1125317561","full_name":"sentdm/twilio-message-export","owner":"sentdm","description":"Export the last 30 days of Twilio SMS/MMS message records to JSONL using the Bulk Export API","archived":false,"fork":false,"pushed_at":"2025-12-30T14:10:31.000Z","size":6,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-25T07:08:03.290Z","etag":null,"topics":["bulk-export","cli","data-export","messaging","migration","mms","python","sms","twilio"],"latest_commit_sha":null,"homepage":"https://www.sent.dm","language":"Python","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/sentdm.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-30T14:10:29.000Z","updated_at":"2026-05-06T05:54:51.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sentdm/twilio-message-export","commit_stats":null,"previous_names":["sentdm/twilio-message-export"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/sentdm/twilio-message-export","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sentdm%2Ftwilio-message-export","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sentdm%2Ftwilio-message-export/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sentdm%2Ftwilio-message-export/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sentdm%2Ftwilio-message-export/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sentdm","download_url":"https://codeload.github.com/sentdm/twilio-message-export/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sentdm%2Ftwilio-message-export/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33905358,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-04T02:00:06.755Z","response_time":64,"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":["bulk-export","cli","data-export","messaging","migration","mms","python","sms","twilio"],"created_at":"2026-06-04T12:30:24.594Z","updated_at":"2026-06-04T12:30:25.507Z","avatar_url":"https://github.com/sentdm.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Twilio Message Export\n\nExport the last 30 days of SMS/MMS message records from your Twilio account using the [Bulk Export API](https://www.twilio.com/docs/usage/bulkexport).\n\n## Quick Start\n\n```bash\n# Clone the repo\ngit clone https://github.com/sent-dm/twilio-message-export.git\ncd twilio-message-export\n\n# Install dependencies\npip install -r requirements.txt\n\n# Set your Twilio credentials\nexport TWILIO_ACCOUNT_SID=\"ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\nexport TWILIO_AUTH_TOKEN=\"your_auth_token\"\n\n# Run the export\npython twilio_message_export.py\n```\n\n## Requirements\n\n- Python 3.7+\n- Twilio Account SID and Auth Token ([find them here](https://console.twilio.com/))\n\n## What It Does\n\n1. Creates a Bulk Export job for the last 30 days of messages\n2. Polls Twilio until the export completes (typically 5-30 minutes)\n3. Downloads each day's data and combines into a single file\n4. Outputs a `.jsonl` file with one message per line\n\n## Output Format\n\nThe script produces a [JSON Lines](https://jsonlines.org/) file:\n\n```\nmessages_export_2024-11-28_to_2024-12-28.jsonl\n```\n\nEach line is a JSON object containing all fields from the [Twilio Bulk Export API](https://www.twilio.com/docs/usage/bulkexport):\n\n```json\n{\n  \"sid\": \"SMxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n  \"account_sid\": \"ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n  \"messaging_service_sid\": \"MGxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n  \"date_created\": \"2024-12-15T14:32:01Z\",\n  \"date_sent\": \"2024-12-15T14:32:02Z\",\n  \"date_updated\": \"2024-12-15T14:32:05Z\",\n  \"from\": \"+15551234567\",\n  \"to\": \"+15559876543\",\n  \"body\": \"Your message content here\",\n  \"status\": \"delivered\",\n  \"direction\": \"outbound-api\",\n  \"num_segments\": 1,\n  \"num_media\": 0,\n  \"price\": \"-0.00750\",\n  \"error_code\": null\n}\n```\n\n### Available Fields\n\n| Field | Description |\n|-------|-------------|\n| `sid` | Unique message identifier (SM...) |\n| `account_sid` | Your Twilio Account SID (AC...) |\n| `messaging_service_sid` | Messaging Service SID if used (MG...) |\n| `date_created` | When the message was created (UTC, ISO 8601) |\n| `date_sent` | When the message was sent (UTC, ISO 8601) |\n| `date_updated` | When the message was last updated (UTC, ISO 8601) |\n| `from` | Sender phone number |\n| `to` | Recipient phone number |\n| `body` | Message content |\n| `status` | Delivery status: `queued`, `sending`, `sent`, `delivered`, `undelivered`, `failed` |\n| `direction` | `inbound`, `outbound-api`, `outbound-call`, `outbound-reply` |\n| `num_segments` | Number of SMS segments |\n| `num_media` | Number of MMS media attachments |\n| `price` | Cost of the message (may not be present on all records) |\n| `error_code` | Error code if failed (null if successful) |\n\n\u003e **Note**: Bulk Export excludes `price_units`, `api_version`, `error_message`, `uri`, and `subresource_uris` fields. The `price` field may not be present on all records.\n\n## Configuration\n\n| Environment Variable | Required | Description |\n|---------------------|----------|-------------|\n| `TWILIO_ACCOUNT_SID` | Yes | Your Twilio Account SID (starts with `AC`) |\n| `TWILIO_AUTH_TOKEN` | Yes | Your Twilio Auth Token |\n\n## Notes\n\n- **Date Range**: Exports cover 30 days ending 2 days ago (Twilio API requirement)\n- **Processing Time**: Large accounts may take 10-30 minutes\n- **Rate Limits**: Maximum 366 days of exports per UTC day\n- **File Retention**: Twilio deletes export files after 7 days\n\n## Troubleshooting\n\n**\"Missing Twilio credentials\"**\n- Ensure both `TWILIO_ACCOUNT_SID` and `TWILIO_AUTH_TOKEN` are set\n- Check for typos or extra whitespace\n\n**\"Authentication failed\"**\n- Verify credentials at [console.twilio.com](https://console.twilio.com/)\n- Ensure you're using the main Account SID, not a subaccount\n\n**\"Rate limited\"**\n- You've exceeded 366 days of exports in a UTC day\n- Wait until midnight UTC and try again\n\n**Export job stuck**\n- The script will timeout after 2 hours\n- Check job status at [console.twilio.com](https://console.twilio.com/)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsentdm%2Ftwilio-message-export","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsentdm%2Ftwilio-message-export","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsentdm%2Ftwilio-message-export/lists"}