# Server-to-server integration guide

### Step 1: Obtaining and testing JSON feed with offerers

JSON feed with offers:

```json
https://wallapi.tappads.io/v1/feed?apikey={API_KEY}&user_id={TELEGRAM_USER_ID}&ip={USER_IP}&ua={USER_AGENT}&lang={LANG}&is_premium={IS_PREMIUM}
```

**{TELEGRAM\_USER\_ID}** — numeric value of the Telegram user ID

**{API\_KEY}** — your unique API key, issued in your cabinet

**{IP}** — user IP

**{USER\_AGENT}** — The user's User Agent (the value needs to be escaped).

**{LANG}** — user language (from the Telegram API)

**{IS\_PREMIUM}** — **true** or **false** depending on whether the user has premium subscription

Pass a user ID with each feed request. You do not need to cache the response.

Example of a feed response:

```json
[
	{
"id": 5,
"name": " Spin the reels, earn coins and catch collectibles", "icon":
"https://s3.eu-central-1.amazonaws.com/surfermedia/media/xh/tG/iq/xht GiqapwFDnJQvILqxnKLFxRZgRuxFH.jpg",
"description": "",
"url": "https://t.me/the_bot?start=171812t2c7096235293530528940545",
"payout": 0.04, "currency": "USDT", "is_done": true, "click_postback":
"https://wallapi.tappads.io/v1/click?user_id=123456&offer_id=5&apikey =123456-7479-42b5-aaea-aa679e0bba7c",
"btn_label": "Play Now" 
	}
]
```

### Step 2: Testing the feed

1. Get and parse a JSON feed with a single test offer.
2. Add the received offerer to the Earn/Quests screen.
3. Perform the actions specified in the offer to test it.

### Step 3: Click Postback

When clicking on the action button, direct the user to the `url` link. At the same time, perform a `click_postback` request (HTTP GET).

* It is **mandatory** to add the **IP** and **ua** of the user in the link.
* Additionally, sub2, sub3, sub4 parameters can be added.

*Example:*

```json
https://wallapi.tappads.io/v1/click?user_id=123456&offer_id=5&apikey=123456-7479-42b5-aaea-aa679e0bba7c&ip=192.168.0.1&ua=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36&sub2=bbb&sub3=ccc&sub4=ddd
```

The **is\_done** flag tells whether this user has executed this offer (to render the button, if necessary).

### Step 4: **Checking Task Statuses**

There are two options to check task status.

* **You go to our API and check whether the user completed the task**

Use API method *check-complete-for-user* from here <https://wallapi.tappads.io/swagger/pub/index.html>

* **We send you a postback everytime the user completes the task**

You need to provide us the URL that will receive Postback requests after users perform actions. We will add this URL to our system.

*An example of a postback after a target action has been performed:*

```json
https://your.domain?offer={oid}&payout={payout}¤cy={currency}&goal_id={goal_id}&clickid={clickid}&ip={ip}&ua={USER_AGENT}&telegram_user_id={telegram _user_id}&sub2={sub2}&sub3={sub3}&sub4={sub4}
```

After performing the target action, we perform an HTTP GET to the address, that you provide to us. We can pass some sub parameters to the postback:

```json
{oid}
{payout}
{currency}
{goal_id}
{clickid}
{ip}
{sub1} #what you sent in click_postback
{sub2} #what you sent in click_postback
{sub3} #what you sent in click_postback
{sub4} #what you sent in click_postback
```

### Step 5: Obtaining the actual offers

After successful testing, we will provide you with real offers for further use. Testing of the real offer follows a similar scheme.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tappadsdocs.gitbook.io/tappads/publishers/feed-integration/server-to-server-integration-guide.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
