Discourse Amazon SNS notifications

:information_source: Summary Send push notifications via Amazon SNS to a custom mobile application.
:hammer_and_wrench: Repository Link GitHub - discourse/discourse-amazon-sns
:open_book: Install Guide How to install plugins in Discourse

The discourse-amazon-sns plugin enables push notifications in Discourse forums through Amazon Simple Notification Service (SNS). It’s designed to work in conjunction with a mobile app to deliver push notifications to iOS and Android devices via APNS and GCM/FCM. Amazon SNS handles the communication with each protocol, this plugin ensures that Discourse events (replies, watched topics, PMs, etc.) trigger events in SNS.

Features

  • Push notification support for both iOS (APNS) and Android (GCM/FCM) platforms
  • Device token registration and management
  • Automatic handling of disabled or invalid endpoints
  • Integration with Discourse’s existing notification system
  • Support for React Native webview communication

Requirements

  • AWS account with SNS access
  • Amazon SNS platform applications configured for:
    • iOS (APNS or APNS_SANDBOX)
    • Android (GCM/FCM)
  • AWS credentials with permissions to publish to SNS
  • Mobile application that can register for and receive push notifications

Settings

Name Description
enable_amazon_sns_pns Enable/disable the plugin functionality
amazon_sns_access_key_id AWS access key ID
amazon_sns_secret_access_key AWS secret access key
amazon_sns_region AWS region (e.g., us-east-1)
amazon_sns_apns_application_arn ARN for the iOS platform application in SNS
amazon_sns_gcm_application_arn ARN for the Android platform application in SNS
5 Likes

Hi everyone! I’m using Discourse 3.5.2 by discourse/discourse image, and this is the only plugin that causes problems during installation, resulting in a 5xx error in our installation. The error is as follows:

ActionView::Template::Error (The asset 'plugins/discourse-amazon-sns.js' was not found in the load path.)
lib/freedom_patches/propshaft_patches.rb:16:in `compute_asset_path'
app/helpers/application_helper.rb:97:in `script_asset_path'
app/helpers/application_helper.rb:147:in `block in preload_script'
app/helpers/application_helper.rb:146:in `map'
app/helpers/application_helper.rb:146:in `preload_script'
app/views/layouts/application.html.erb:36
app/views/layouts/application.html.erb:35:in `each'
app/views/layouts/application.html.erb:35
lib/topic_list_responder.rb:16:in `block (2 levels) in respond_with_list'
lib/topic_list_responder.rb:7:in `respond_with_list'
app/controllers/list_controller.rb:115:in `block (2 levels) in <class:ListController>'
app/controllers/application_controller.rb:433:in `block in with_resolved_locale'
app/controllers/application_controller.rb:433:in `with_resolved_locale'
app/controllers/application_controller.rb:1065:in `ensure_dont_cache_page'
lib/middleware/omniauth_bypass_middleware.rb:35:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:415:in `call'
lib/middleware/csp_script_nonce_injector.rb:12:in `call'
config/initializers/008-rack-cors.rb:14:in `call'
lib/middleware/default_headers.rb:13:in `call'
config/initializers/100-quiet_logger.rb:20:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
lib/middleware/enforce_hostname.rb:23:in `call'
lib/middleware/processing_request.rb:12:in `call'
lib/middleware/request_tracker.rb:410:in `call'

All assets have already been precompiled by running:

RAILS_ENV=production bundle exec rake assets:precompile

Can you help me understand what might be causing this problem?

Sorry about that. Is this a new error? Meaning, did you already have this plugin installed and it stopped working at some point?

It’s something new, we just introduced the plugin into our installation (we have other plugins and they all work), but then the site gives a 5xx error, and when I check the logs, I see what I sent you. My Dockerfile looks something like this:

FROM discourse/discourse:3.5.2

WORKDIR /var/www/discourse

# Install discourse-amazon-sns plugin
RUN git clone https://github.com/discourse/discourse-amazon-sns.git /var/www/discourse/plugins/discourse-amazon-sns && \
    chown -R discourse:discourse /var/www/discourse/plugins/discourse-amazon-sns

EXPOSE 80

That is an experimental image, and will have plenty of compatibility issues with plugins

2 Likes

Yeah, @caue-pareto, sorry, I think this has to do with that image. I see no issues with this plugin on my self-hosted install following the standard install.

1 Like