https://github.com/sparkpost/webhook-report-sample
Build a report of recipient OS usage from SparkPost click events and the User-Agent header
https://github.com/sparkpost/webhook-report-sample
Last synced: 6 months ago
JSON representation
Build a report of recipient OS usage from SparkPost click events and the User-Agent header
- Host: GitHub
- URL: https://github.com/sparkpost/webhook-report-sample
- Owner: SparkPost
- Created: 2017-02-27T14:36:18.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-27T14:53:15.000Z (over 9 years ago)
- Last Synced: 2024-12-29T11:49:05.566Z (over 1 year ago)
- Language: PHP
- Size: 5.86 KB
- Stars: 1
- Watchers: 7
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SparkPost Sample: Using Webhooks To Report on Recipient OS Preferences
This project accepts SparkPost webhooks event batches and maintains a report of recipient OS preferences based on the `user_agent` field from `click` events.
## Usage
### Heroku
You can deploy it directly to Heroku: [](https://heroku.com/deploy).
Register your service as a webhook endpoint on your SparkPost account. You can [do that here](https://app.sparkpost.com/account/webhooks).
The webhook endpoint is at `https://your-app-name.herokuapp.com/clicks.php`.
The report is at `https://your-app-name.herokuapp.com/`.
### Manual Deployment
Prerequisites:
- PostgreSQL (tested with 9.5)
- PHP 5.6
Steps:
- Clone this repo
- Create an empty database for this service
- Edit public/clicks.php to add a PostgreSQL database URL. Format: `postgres://username:password@dbhostname:5432/dbname`
- Configure your webserver to serve from `/public`.
- Register your service as a webhook endpoint on your SparkPost account. You can [do that here](https://app.sparkpost.com/account/webhooks).
The webhook endpoint is at `https://your-app-name.herokuapp.com/clicks.php`.
The report is at `https://your-app-name.herokuapp.com/`.