Jump to content

Extension:SparkPost

From mediawiki.org
MediaWiki extensions manual
SparkPost
Release status: stable
Implementation Notify
Description Enables MediaWiki to use the SparkPost API for email distribution.
Author(s)
Latest version 1.1
Compatibility policy Master maintains backward compatibility.
MediaWiki 1.31+
PHP 5.6+
Database changes No
Composer sparkpost/sparkpost
License GNU General Public License 2.0 or later
Download
README
  • $wgSparkPostOpenTracking
  • $wgSparkPostAPIKey
  • $wgSparkPostClickTracking
  • $wgSparkPostTransactional
Quarterly downloads 0
Translate the SparkPost extension if it is available at translatewiki.net
Issues Open tasks · Report a bug

The SparkPost extension enables MediaWiki to send emails through SparkPost's API service.

Installation

[edit]
  • Download and move the extracted SparkPost folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/SparkPost
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'SparkPost' );
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
You will have to run composer update in extensions/SparkPost/ folder so that composer can pick up and install the required SparkPost dependencies for the extension to run smoothly.

Configuration

[edit]

You need to have an account on https://www.sparkpost.com and a valid API key in order to successfully send emails via SparkPost using this extension. Getting an API key is really easy, just create an account and follow the steps, the last step will give away the API key plus, don't forget to verify your email (account after creation). See here for more information.

Security Warning: Do not paste your SparkPost keys directly in your SparkPost/extension.json as this will be a vulnerability making someone else to be able to use your account to send emails or perform other bad stuff.

With a valid API Key, configure your API key in LocalSettings.php , plus this also requires that you've properly configured a sending domain using your SparkPost account (this is SparkPost specific):

$wgSparkPostAPIKey = "YOUR_API_KEY_HERE";

In addition to the API key config variable, this extension provides 3 more config variables used in setting various options when using the Spark Post API to distribute emails such as: $wgSparkPostClickTracking, $wgSparkPostOpenTracking and $wgSparkPostTransactional. These variables are set to "true" for default behavior with spark post.

Test your settings

[edit]

Go to Special:EmailUser and send an email to your own address to verify that the extension is working. You'll receive an email from the address you inputed and check to see if it's sent via the SparkPost API.

Used by Production Wikis

[edit]

This extension is already used by some production wiki instances, see: https://wikiapiary.com/wiki/Extension:SparkPost.