Skip to content

tuck1s/sparkpost-traffic-gen

Repository files navigation

Sign up for a SparkPost account and visit our Developer Hub for even more content.

SparkPost Traffic Generator

Build Status

A simple app, which can easily be deployed to Heroku, to generate random traffic through your SparkPost account towards the "bouncy sink". Note that all sent messages count towards your account usage.

Deploying to Heroku

Pre-requisites: a Heroku account, verified via credit card (free tier is fine). Click here:

Deploy
  • Choose a name for your Heroku app (must start with a lowercase letter).

  • Enter your values for the environment variables. You'll need a valid SparkPost API key and sending domain.

  • After a short time Heroku should report Build finished

  • Configure the scheduler:

    • From your app overview, click next to clock icon:
    • Add New Job. In command box, type ./sparkpost-traffic-gen.py

    • Choose Schedule Every 10 Minutes. Next due time is displayed.

  • Open the app to view metrics on your generator.

Environment variables (configured via Heroku's start dialog):

SPARKPOST_API_KEY
    API key on your SparkPost account, with transmission rights.

MESSAGES_PER_MINUTE_LOW
    Lowest number of messages to be sent per minute, from 0 to 10000

MESSAGES_PER_MINUTE_HIGH
    Highest number of messages to be sent per minute, from 0 to 10000

FROM_EMAIL
    FROM address belonging to a valid sending domain on your account.  e.g. [email protected]

Optional:

SPARKPOST_HOST
    The URL of the SparkPost API service you're using. When omitted, defaults to https://api.sparkpost.com.

TRACK_OPENS
    (True / False), selects whether SparkPost open tracking is active. When omitted, defaults to True.

TRACK_CLICKS
    (True / False), selects whether SparkPost click tracking is active. When omitted, defaults to True.

Traffic handling

The bouncy-sink recipient domain responds to traffic according to a statistical model:

Monitoring

Click Open App (top right). Results appear once scheduler has run at least once. Does not display your API key as it's a public page. You should see a screen below.

For detailed logs, go to App Settings / More / View Log file.

A JSON-format reporting endpoint is also available - see app main screen for a link (URL ending in /json).

Changing settings, stopping

While running, you can change values in the Settings / Reveal Config Vars page. Changes are displayed on Open App screen immediately and affect traffic on the next scheduled run. No need to restart dynos.

To stop traffic, go to your app overview, select the Scheduler (clock icon), select "Remove".

Changing settings in the code

If you wish to generate traffic going to some place other than the bouncy-sink, the code can easily be changed.

Note that sending traffic to real ISP domains with fake addresses is likely to harm your reputation - use with care.

You can also easily customise

  • the metadata included with each recipient (Cities, Genders)
  • The target link that will be clicked by the sink
  • Campaign names
  • Subject lines
  • Link names (that appear in the SparkPost Engagement report, for example)
  • To address prefix and name
  • Default send interval that your scheduler is running to (used to translate the per-minute env var settings into numbers)
  • API call batch size (chosen for efficiency)

See also

Internal documentation, and install instructions for other platforms in INSTALLING.md

How to contribute to this project: CONTRIBUTING.md

About

Traffic generator service that can be deployed on Heroku

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published