This project introduces a CRM system specifically designed for traffic arbitrage teams. Notable features include:
-
Prospects
tracking and management:prospects
are virtual entities with user details, likeUser-Agent
,IP
,Referrer
. They simulate the tracking of a user's journey to a specific landing page. Currently, they are gathered as a simplepost
requests, but this functionality will be adjusted to tracking ofget
requests through the small tracking image, embedded into the landing page. Thus, it will be possible to track real-life visits of users to landing pages. Also, each prospect has auser_id
property, which makes it possible to track the specific team member responsible for the prospect. As a result, users, orBuyers
to be precise, can monitor their own performance. -
Orders
tracking and management:orders
are virtual entities, that simulate the filling of order form by user. Eachorder
is derived from aprospect
, therefore providing the opportunity to track the performance of the concreteprospects
source. Currently,orders
are gathered aspost
requests. However, under real-life conditions, they can be collected using an order form on the landing page. -
Management of
teams
: each team has severalBuyers
and aTeam Lead
.Team Lead
can assess the team performance and act accordingly. Currently, there is corresponding html-frontend section, allowing management of the teams.Also, teams management API has been implemented. All API requests to
teams
-related endpoints require authorization. Authorization is being performed through JWT. -
User management: there are several roles in the system -
Buyer
,Team Lead
,Funds Coordinator
, andOwner
. Each with its own set of permissions and responsibilities.Buyer
is an expert, responsible for attracting theprospects
andorders
.Team Lead
is a management position that involves tracking team performance and assisting in improving the efficiency of team members.Fund Coordinator
is responsible for replenishing the accounts ofBuyers
in various systems used for traffic acquisition.Owner
- is the owner of the team. Each user's page provides a detailed listing ofprospects
generated by them.Users
,Prospects
, andTeams
can not only be viewed, but also created, updated, and deleted. -
The initial analytics functionality has been implemented in the form of four graphs. As an example, the registration dynamics of both the
Team Lead
andBuyer
user types are showcased on the home page:Also, there's a graph showcasing the dynamics of
Prospects
generation, as well as a bar chart that can display the number of members in each team. Additionally, it provides the opportunity to analyze the cumulative performance of each team in terms of the quantity of generatedProspects
: -
A bonus feature of this system is the comprehensive Admin section. It is intended for owners or superusers, providing them with a platform where they can manage and control any aspect of the system as desired. While the 'usual' frontend management through HTML templates is currently under development, the 'admin' section is already fully equipped with all necessary features to manage all available entities within the system.
-
In addition to this, all API requests can be tested using Swagger for a streamlined and efficient testing process. All endpoints displayed on the Swagger page are fully functional. In the 'Usage' section below, some endpoints are documented. However, due to ongoing active development, the most accurate information about available functionalities can be found directly through Swagger.
- Python3 must be installed. If not, please, visit https://www.python.org/ and choose appropriate version for your OS.
- Clone the repository and navigate to the cloned folder using the
cd
command:git clone https://github.com/luxuriant777/CRM-system-for-arbitrage-team
cd CRM-system-for-arbitrage-team
- Switch to the
dev
branch:git checkout dev
- Create and activate the virtual environment - this is a separate container where all the necessary dependencies will
be installed:
- creation:
python -m venv venv
- activation:
venv\Scripts\activate (on Windows)
source venv/bin/activate (on macOS)
- Install packages:
pip install -r requirements.txt
- Apply migrations:
python manage.py migrate
- Create a superuser. You will be asked to provide a username, email (optional), and password:
A superuser account can be used to log in to the Django administrative interface and perform administrative tasks.
python manage.py createsuperuser
- Create the necessary groups and permissions with this command:
python manage.py check
- You can start the development server by running:
Then you will be able to access the administrative interface by visiting
python manage.py runserver
http://127.0.0.1:8000/admin
in your web browser.
To enable the simultaneous storage of multiple prospect
or order
creation requests, it is necessary to install
RabbitMQ and start celery
. Assuming, that you have RabbitMQ installed, run the
following command in the command prompt or bash while in the root folder of the project:
celery -A crm_arbitrage worker --loglevel=info -P eventlet
This action is mandatory in order to be able to accept prospects
and orders
. If Celery
is not up and running, the
prospects
and orders
will not be written to the database.
-
Open Postman and enter this URL:
http://127.0.0.1:8000/api/users/register/
-
Select the HTTP method as "POST".
-
Click on the "Body" tab below the URL field.
-
Select the "raw" option and choose "JSON" from the dropdown menu.
-
In the request body, provide the JSON payload containing the username, email, and password. For example:
{ "username": "example_user", "email": "user@example.com", "password": "secretpassword" }
-
Click the "Send" button to send the request.
-
Postman will send the POST request to the specified URL with the provided JSON payload. You should receive a response indicating whether the user registration was successful or any errors that occurred. If the registration was successful, you will see:
{ "message": "User registered successfully.", "user": { "username": "example_user", "email": "user@example.com" } }
-
Open Postman and enter this URL:
http://127.0.0.1:8000/api/users/login/
-
Select the HTTP method as "POST".
-
Click on the "Body" tab below the URL field.
-
Select the "raw" option and choose "JSON" from the dropdown menu.
-
In the request body, provide the JSON payload containing the username and password. For example:
{ "username": "example_user", "password": "secretpassword" }
-
Click the "Send" button to send the request.
-
Postman will send the POST request to the specified URL with the provided JSON payload. You should receive a response indicating whether the user login was successful or any errors that occurred. If the login was successful, you will see this:
{ "message": "User logged in successfully.", "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjg1OTc0MTQ3LCJpYXQiOjE2ODU5NzM4NDcsImp0aSI6ImZkZTE2NWZjZmQyZDRkOTJhY2FjNmQ1NTQyODBlZGQwIiwidXNlcl9pZCI6MiwicGF5bG9hZCI6eyJ1c2VyX2lkIjoyLCJ1c2VybmFtZSI6ImV4YW1wbGUifX0.F4y3hLbOk3UcJBoSKZIaZvGO2HtXCghgy7vszq4mIuM" }
The
access_token
should be used to make requests to all endpoints that require authorization.
-
Open Postman and enter this URL:
http://127.0.0.1:8000/api/users/list/
-
Select the HTTP method as "GET".
-
Click on the "Authorization" tab below the URL field.
-
Select the "Bearer Token" option and enter the
access_token
you received when performed the login request. For example:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjg1OTc0MTQ3LCJpYXQiOjE2ODU5NzM4NDcsImp0aSI6ImZkZTE2NWZjZmQyZDRkOTJhY2FjNmQ1NTQyODBlZGQwIiwidXNlcl9pZCI6MiwicGF5bG9hZCI6eyJ1c2VyX2lkIjoyLCJ1c2VybmFtZSI6ImV4YW1wbGUifX0.F4y3hLbOk3UcJBoSKZIaZvGO2HtXCghgy7vszq4mIuM
-
Click the "Send" button to send the request.
-
Postman will send the GET request to the specified URL. You should receive a response with the list of all registered users, or message with errors that occurred. If the request was successful, you will see this:
[ { "id": 1, "username": "example_user", "email": "user@example.com" }, { "id": 2, "username": "example", "email": "user1@example.com" }, { "id": 3, "username": "example3", "email": "user3@example.com" }, { "id": 4, "username": "example4", "email": "user3@example.com" } ]
-
Open Postman and enter this URL:
http://127.0.0.1:8000/api/prospects/create/
-
Select the HTTP method as "POST".
-
Click on the "Body" tab below the URL field.
-
Select the "raw" option and choose "JSON" from the dropdown menu.
-
In the request body, provide the JSON payload containing the ip address, useragent, and referral source. For example:
{ "ip_address": "192.168.4.1", "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36", "referral_source": "example.com" }
-
Click the "Send" button to send the request.
-
Postman will send the POST request to the specified URL with the provided JSON payload. You should receive a response indicating whether the request was successful or any errors that occurred. If the request was successful, you will see this:
{ "ip_address": "192.168.4.1", "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36", "referral_source": "example.com" }
-
Open Postman and enter this URL:
http://127.0.0.1:8000/api/prospects/list/
-
Select the HTTP method as "GET".
-
Click on the "Authorization" tab below the URL field.
-
Select the "Bearer Token" option and enter the
access_token
you received when performed the login request. For example:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjg1OTc0MTQ3LCJpYXQiOjE2ODU5NzM4NDcsImp0aSI6ImZkZTE2NWZjZmQyZDRkOTJhY2FjNmQ1NTQyODBlZGQwIiwidXNlcl9pZCI6MiwicGF5bG9hZCI6eyJ1c2VyX2lkIjoyLCJ1c2VybmFtZSI6ImV4YW1wbGUifX0.F4y3hLbOk3UcJBoSKZIaZvGO2HtXCghgy7vszq4mIuM
-
Click the "Send" button to send the request.
-
Postman will send the GET request to the specified URL. You should receive a response with the list of all prospects, or message with errors that occurred. If the request was successful, you will see this:
[ { "id": 1, "ip_address": "192.168.0.1", "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36", "referral_source": "example.com", "created_at": "2023-06-05T16:11:00.675296Z" }, { "id": 2, "ip_address": "192.168.1.1", "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36", "referral_source": "example.com", "created_at": "2023-06-05T16:11:13.301890Z" }, { "id": 3, "ip_address": "192.168.3.1", "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36", "referral_source": "example.com", "created_at": "2023-06-05T16:11:17.313468Z" } ]
-
Open Postman and enter this URL:
http://127.0.0.1:8000/api/orders/create/
-
Select the HTTP method as "POST".
-
Click on the "Body" tab below the URL field.
-
Select the "raw" option and choose "JSON" from the dropdown menu.
-
In the request body, provide the JSON payload containing the prospect's ID, email, phone number, first and last names, and delivery address. This simulates a situation where the potential client has made a purchase and filled out the order form. Here is the example:
{ "prospect_id": 1, "email": "example@example.com", "phone_number": "1234567890", "first_name": "John", "last_name": "Doe", "delivery_address": "123 Main St, City, Country" }
-
Click the "Send" button to send the request.
-
Postman will send the POST request to the specified URL with the provided JSON payload. You should receive a response indicating whether the request was successful or any errors that occurred. If the request was successful, you will see this:
{ "prospect_id": 1, "email": "example@example.com", "phone_number": "1234567890", "first_name": "John", "last_name": "Doe", "delivery_address": "123 Main St, City, Country", "prospect": { "id": 1, "ip_address": "192.168.8.1", "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36", "referral_source": "example.com", "created_at": "2023-06-06T03:08:18.381655Z" } }
-
Open Postman and enter this URL:
http://127.0.0.1:8000/api/orders/list/
-
Select the HTTP method as "GET".
-
Click on the "Authorization" tab below the URL field.
-
Select the "Bearer Token" option and enter the
access_token
you received when performed the login request. For example:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjg1OTc0MTQ3LCJpYXQiOjE2ODU5NzM4NDcsImp0aSI6ImZkZTE2NWZjZmQyZDRkOTJhY2FjNmQ1NTQyODBlZGQwIiwidXNlcl9pZCI6MiwicGF5bG9hZCI6eyJ1c2VyX2lkIjoyLCJ1c2VybmFtZSI6ImV4YW1wbGUifX0.F4y3hLbOk3UcJBoSKZIaZvGO2HtXCghgy7vszq4mIuM
-
Click the "Send" button to send the request.
-
Postman will send the GET request to the specified URL. You should receive a response with the list of all orders, or message with errors that occurred. If the request was successful, you will see this:
[ { "id": 1, "prospect_id": 3, "email": "example@example.com", "phone_number": "1234567890", "first_name": "John", "last_name": "Doe", "delivery_address": "123 Main St, City, Country", "created_at": "2023-06-06T02:52:07.115852Z", "prospect": { "id": 3, "ip_address": "192.168.8.1", "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36", "referral_source": "example.com", "created_at": "2023-06-06T02:51:45.971552Z" } }, { "id": 2, "prospect_id": 3, "email": "example@example.com", "phone_number": "1234567890", "first_name": "John", "last_name": "Doe", "delivery_address": "123 Main St, City, Country", "created_at": "2023-06-06T02:52:09.917670Z", "prospect": { "id": 3, "ip_address": "192.168.8.1", "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36", "referral_source": "example.com", "created_at": "2023-06-06T02:51:45.971552Z" } }, { "id": 3, "prospect_id": 3, "email": "example@example.com", "phone_number": "1234567890", "first_name": "John", "last_name": "Doe", "delivery_address": "123 Main St, City, Country", "created_at": "2023-06-06T02:52:11.116232Z", "prospect": { "id": 3, "ip_address": "192.168.8.1", "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36", "referral_source": "example.com", "created_at": "2023-06-06T02:51:45.971552Z" } } ]
Please note that all information related to the details of the corresponding prospect will also be included.
Contributions to this project are welcomed. If you find any bugs or areas for improvement, please feel free to submit
a pull request to the dev
branch or open an issue. Your input is appreciated and helps make this project better for
everyone. We look forward to your feedback and contribution.
This project is licensed under the GNU General Public License (GPL) version 3.0.
The Arbitrage Teams CRM system is furnished on an 'as is' basis, with no warranties or assurances whatsoever. The creators and contributors of this platform disclaim all liability for any damages or losses resulting from its usage.
The platform is devised to aid in tracking user activity, managing prospects, orders, teams, etc. However, it's entirely your responsibility to utilize this tool wisely. We urge you to exercise prudence and operate the CRM system at your own discretion. Prior to deploying it extensively, we recommend testing it on a small scale or in a non-production environment.