Skip to content

virusimmortal00/post-af

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

post-af

Docker Nginx Python Flask Sqlite jQuery Bootstrap


Logo

post-af

All-in-one test tool for easily generating and sending AppsFlyer S2S API messages.

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Disclaimer
  5. Contact

About The Project

Product Name Screen Shot

post-af is a Python/Flask web app packaged within a Docker image alongside NGINX and uWSGI, allowing for a simple 'turn-key' self-hosted testing tool for the AppsFlyer S2S API.

All pre-requisites and configurations needed in order for this tool to get up and running are already set and included within the image, allowing for fast and straight forward deployments.

Although the source code has been provided within this repo, most users will only need the pre-built Docker image, hosted on Docker Hub:

https://hub.docker.com/r/virusimmortal00/post-af

If you're unfamiliar with Docker and/or the link above, fear not, as directions are provided below.

(back to top)

Built With

flask:
https://github.com/pallets/flask/
https://github.com/helloflask/bootstrap-flask
https://github.com/wtforms/flask-wtf/
https://github.com/wiltonsr/Flask-Toastr/tree/master
js:
https://github.com/python-jsonschema/jsonschema/tree/main
https://github.com/moment/moment
https://github.com/gasparesganga/jquery-loading-overlay
https://github.com/wenzhixin/bootstrap-table
back-end:
https://github.com/tiangolo/uwsgi-nginx-flask-docker
https://www.nginx.com/
https://uwsgi-docs.readthedocs.io/en/latest/
etc:
https://github.com/FortAwesome/Font-Awesome

(back to top)

Getting Started

Docker Instructions

Docker can be deployed either via Docker Desktop [easiest] or through a standalone Docker Engine instance (if you have this, you likely don't need these directions).

You can get Docker desktop here: https://docs.docker.com/get-docker/

or install Docker using your favorite package manager via terminal.

For this example, we'll use Homebrew for macOS:

brew install docker

(back to top)

Prerequisites

Beyond Docker - you're going to need a general working knowledge of how the AppsFlyer S2S API works (as these docs are not provided here), an active account at AppsFlyer HQ, and at least one app configured (as you'll need your API dev key and app ID).

Luckily, you won't need to know much about Docker, once the container is running, the system is plug and play from your local browser.

(back to top)

Installation

Note: The below steps use the terminal for setup, rather than the Docker Desktop UI. Although I feel the terminal approach is a little more foolproof, you can certainly use the UI instead to the same end result - just map port 80 to 80 and you're all set config-wise.

  1. After Docker is installed, open your terminal and pull the image from Docker hub:
  docker pull virusimmortal00/post-af:v1
  1. Run the container 'post-af' on port 80 (default HTTP) from the image you just pulled:
   docker run -d --name post-af -p 80:80 virusimmortal00/post-af:v1
  1. Open your browser and enter 'localhost' as the destination:
localhost
  1. From here, you're all set to begin posting API messages - just enter your dev key and app id, then either paste in your own JSON message body or use one of the provided template buttons. As you post your calls, you'll see the response onscreen through both a short notification and also on the right hand side in the post history area.

  2. The next section below covers the finer details around the apps functionality.

(back to top)

Usage

JSON Body Validation

For those already intimately familiar with the AppsFlyer S2S endpoint, you'll know that it can be fairly forgiving when it comes to accepting data... therefore - I've taken steps to validate your json body (based on my own re-created schema) before throwing it over to the S2S endpoint (ultimately saving you time).

If you run into any issues where you have legitimate data that's being rejected, please let me know.

I hope to continue adding better and smarter validation rules here as time goes on... we'll see!

(back to top)

Inserting Templates

Template installs/events for both iOS and Android are available via buttons at the bottom of the screen:

templates

Timestamps are generated dynamically on click in order to keep the data relevant, as installs/events have a limited window for acceptable submission.

For installs, the current time in UTC is used for both timestamp and inst_date:

{
  "timestamp": "2023-06-27T16:31:21.857",
  "inst_date": "2023-06-27T16:31:21.857",
}

For events, the current time in UTC is used for the event, with the install timestamp set -15 hours before, to simulate a realistic install to event timeframe:

{
  "timestamp": "2023-06-27T16:31:21.857",
  "inst_date": "2023-06-27T01:31:21.858",
}

Additionally, just for the sake of data traceability, the IP provided in the template comes from the IP of your workstation running the tool.

All templates, once inserted, can be manually configured before posting - so feel free to adjust these as needed.

(back to top)

POST History

templates

On the right side of the app you'll see your POST history, pulled from a local sqlite db created when the container is first created. As long as you don't delete this container, your history will be saved and will continue to be accesible.

templates

Clicking on a post entry will bring up additional information about the post in question (allowing for you to copy/paste body contents for re-use).

I've toyed with the idea of adding an option to save out your history to local file - but haven't quite become convinced its worth it - so for now, your history lives and dies with your container.

(back to top)

Disclaimer

Although I do work at AppsFlyer, this app has not been commissioned, endorsed, or approved by AF in any way - it was a labor of love born out of my own downtime. Maybe one day that will change, but for now - disclaimer has been disclaimed :)

Contact

Gmail LinkedIn

(back to top)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published