{"id":19270819,"url":"https://github.com/activecampaign/inbound-demo-rails","last_synced_at":"2025-04-21T20:33:56.386Z","repository":{"id":66239052,"uuid":"145546456","full_name":"ActiveCampaign/inbound-demo-rails","owner":"ActiveCampaign","description":"Demo showing how to use Postmark’s inbound email processing in a Rails app.","archived":false,"fork":false,"pushed_at":"2023-03-10T19:30:55.000Z","size":56,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-04-01T16:08:24.232Z","etag":null,"topics":["postmark","rails","webhooks"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/ActiveCampaign.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}},"created_at":"2018-08-21T10:12:27.000Z","updated_at":"2023-11-23T04:40:56.000Z","dependencies_parsed_at":"2024-11-09T20:39:35.357Z","dependency_job_id":null,"html_url":"https://github.com/ActiveCampaign/inbound-demo-rails","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/ActiveCampaign%2Finbound-demo-rails","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ActiveCampaign%2Finbound-demo-rails/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ActiveCampaign%2Finbound-demo-rails/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ActiveCampaign%2Finbound-demo-rails/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ActiveCampaign","download_url":"https://codeload.github.com/ActiveCampaign/inbound-demo-rails/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250128525,"owners_count":21379530,"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":["postmark","rails","webhooks"],"created_at":"2024-11-09T20:27:33.244Z","updated_at":"2025-04-21T20:33:56.376Z","avatar_url":"https://github.com/ActiveCampaign.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Postmark Inbound Processing Demo (Rails)\n\nThis project contains a demo Rails app that shows how to implement inbound email processing using [Postmark’s inbound webhooks](https://postmarkapp.com/why/inbound).\n\nThe demo app replicates a simple blog. Readers can post responses to an article by sending an email to the app. Responses are processed by Postmark and forwarded to the Rails app using inbound webhooks. Once received the app associates a response with an article and saves it to the database.\n\nYou will need to have a [Postmark account](https://postmarkapp.com) to run this demo. If you don’t have one already, [sign up for a free account](https://account.postmarkapp.com/sign_up).\n\n## Getting Started\n\n_This tutorial assumes you have Ruby 2.4.1 installed. If not, please [install it using RVM](https://rvm.io)._\n\n1. Clone this repository to your local machine.\n\n```bash\ngit clone git@github.com:wildbit/inbound-demo-rails.git\n```\n\n2. Change into the `inbound-demo-rails` directory.\n\n```bash\ncd inbound-demo-rails\n```\n\n3. Install the project dependencies using bundler.\n\n```bash\ngem install bundler\nbundle install\n```\n\n4. Create the SQLite database.\n\n```bash\nrails db:create\n```\n\n5. Run the database migrations.\n\n```bash\nrails db:migrate\n```\n\n6. Seed the database with some example articles.\n\n```bash\nrails db:seed\n```\n\n7. Open the `/config/initializers/postmark.rb` file and add the hash from the Postmark inbound address that emails will be sent to.\n\n```rb\nRails.application.config.postmark_inbound_email_hash = 'YOUR_POSTMARK_INBOUND_EMAIL_ADDRESS_HASH'\n```\n\n_You can find the inbound email address for a Postmark server on the server’s credentials page. The hash is the alphanumeric string that comes before the @ sign. (**c0b622f2dkgj73be69c59033275ef521**@inbound.postmarkapp.com)_\n\n8. Start Ultrahook. (See below for instructions on how to set up Ultrahook.)\n\n```bash\nultrahook inbound-demo 3000\n```\n\n9. Navigate to your Postmark server’s inbound settings page (Settings → Inbound) and set the Webhook field to match your Ultrahook endpoint. (`http://inbound-demo.YOUR_USER.ultrahook.com/responses`)\n\n10. Start the Rails server.\n\n```bash\nrails s\n```\n\n11. Navigate to \u003chttp://0.0.0.0:3000/articles/1\u003e\n\n12. Click the \"Send a response\" button at the bottom of the page to launch your email client.\n\n13. Compose a simple message and hit send.\n\n14. After a few seconds, refresh the page. You should see the content of your email appear in the _Responses_ section at the bottom of the page.\n\n_If your message doesn’t appear, it’s likely there was an error in the Webhook handler. Open the console where you have ultrahook running and make sure there’s a log entry that shows the POST request to `/responses` returning a 200 status code._\n\n\n## Testing Inbound Webhooks Locally with Ultrahook\nIn order to test inbound webhooks while running the app locally, you can use a service called [Ultrahook](http://www.ultrahook.com). Once set up, Ultrahook receives incoming webhooks from Postmark and forwards them to the instance of the app you have running locally on your machine.\n\nThe ultrahook ruby gem is included in this project’s `Gemfile`. Should you need to install it separately, run: `gem install ultrahook`. \n\n1. Sign up for an account at [ultrahook.com](http://www.ultrahook.com)\n2. Add your Ultrahook API key to a file in your home folder:\n```bash\necho \"api_key: YOUR_ULTRAHOOK_API_KEY\" \u003e ~/.ultrahook\n```\n3. Start Ultrahook, ensure the port supplied here matches the port your Rails app is running on (usually 3000).\n```bash\nultrahook inbound-demo 3000\n```\n4. You should now see that Ultrahook has started running. The external URL you can use to forward requests to your local machine will be printed in your console.\n```bash\nAuthenticated as YOUR_USER\nForwarding activated...\nhttp://inbound-demo.YOUR_USER.ultrahook.com -\u003e http://localhost:3000\n```\n5. Log in to your [Postmark](https://account.postmarkapp.com) account.\n6. Select a server that will handle your inbound emails and navigate to the inbound settings page (Settings → Inbound).\n7. Set the webhook field using the Ultrahook URL that was output in your console and hit save. Don’t forget to add the `/responses` path to the end of the URL. This is the endpoint in the Rails app that will handle inbound emails.\n```\nhttp://inbound-demo.YOUR_USER.ultrahook.com/responses\n```\n\nUltrahook will now forward any inbound webhooks from Postmark to your local machine.\n\n## Questions?\n\nIf you need help with anything in this demo, please [create a ticket in the issue tracker](https://github.com/wildbit/inbound-demo-rails/issues/new).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factivecampaign%2Finbound-demo-rails","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Factivecampaign%2Finbound-demo-rails","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factivecampaign%2Finbound-demo-rails/lists"}