Skip to content

Instantly share code, notes, and snippets.

@ewandennis
Created September 21, 2015 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ewandennis/97a7051d59600de6ce7d to your computer and use it in GitHub Desktop.
Save ewandennis/97a7051d59600de6ce7d to your computer and use it in GitHub Desktop.

Introduction

This integration consumes Segment events and uses them to create and maintain recipient lists within SparkPost. For example, when you send 'page' events into Segment.com, a recipient list is created for each page containing the users that visit that page.

The Recipient Lists

  • Everyone
  • Page X visited last 7 days
  • Group X members
  • Screen X visited last 7 days
  • Email openers last 7 days
  • Email clickers last 7 days

Getting Started

After you have integrated Segment with your site, mobile app or server, enable SparkPost in your Segment integrations and add a SparkPost API key which you can create here.

Segment will then begin sending events to SparkPost which you can review by listing them through the SparkPost API:

curl -H "Content-type: application/json" -H "Authorization: YOUR_API_KEY" https://api.sparkpost.com/api/v1/recipient-lists

You can then begin sending transmissions to the recipients on your lists. For details, check out the SparkPost transmission API.

Responsible Sending

The recipient lists with names that end in "last N days" are time-limited to ensure content you send to them is still relevant. However, we expect you to consider carefully whether and what to send to your users on these lists. Here are a few important points to consider:

  • opt in: you can gathering user data so you must obtain their permission before you use it or make contact
  • timeliness: segment events are ephemeral - avoid using stale events to trigger contact.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment