# Transaction-Related Push Notifications

Transaction-related push notifications inform users about **order and payment activity** in your Sharetribe marketplace.

These notifications are critical for keeping users updated about transactions in real time.

### What Are Transaction Push Notifications?

Transaction push notifications are sent when events related to transactions occur, such as:

* Transaction created
* Transaction updated
* Transaction completed
* Transaction cancelled

Each event triggers a **one-time push notification** to the relevant user.

## Create Zap for Transaction Events

Create this Zap **only if you want push notifications for transaction-related events**.

### Step 1: Create a New Zap

1. Click **Create Zap**

### Step 2: Select Sharetribe as Trigger App

1. Choose **Sharetribe**
2. Select **Transaction Events**

<figure><img src="/files/bAPI7y5VyDVEpQjWe11I" alt="" width="563"><figcaption></figcaption></figure>

3. Connect your Sharetribe account
4. Click **Continue**
5. Choose any **Event Type**

<figure><img src="/files/xo1sv5ZoAtR6cXYtLcpP" alt="" width="563"><figcaption></figcaption></figure>

6. Test the trigger

### Step 3: (Optional) Run JavaScript Logic

This step identifies **who should receive the notification**.

1. Add a new step → **Code by Zapier**
2. Choose **Run Javascript**

#### Input Data

| Field Name | Value                       |
| ---------- | --------------------------- |
| customerId | Transaction → Customer → ID |
| providerId | Transaction → Provider → ID |

#### Code Snippet

```javascript
return {
  notifyUserId: inputData.providerId,
  sendNotification: true
};
```

🔹 In Sharetribe, the **customer always initiates** the transaction, so the provider is the opposite user.

### Step 4: Fetch User Details (Optional)

1. Add action → **Sharetribe**
2. Choose **Show User**
3. Map **User ID** → `notifyUserId` (from Code step)
4. Test the step

🔹 This step fetches user details required for sending notifications.

***

### Step 5: Filter Conditions (Recommended)

1. Add **Filter by Zapier**
2. Allow Zap to continue **only if `app_id` exists**
3. This ensures notifications are sent only to valid Twinr users

### Step 6: Send Push Notification to Twinr

1. Add **Webhooks by Zapier**
2. Choose **POST / GET / PUT / Custom Request**
3. Enter the **Twinr Webhook Endpoint**

{% hint style="success" %}
<https://msengageapi.twinr.dev/v3/send-notifications>
{% endhint %}

#### Request Body (API Payload)

```json
{
  "application_id": "string",
  "click_action": {},
  "push_image": "string",
  "push_message": "string",
  "push_title": "string",
  "push_tokens": [
    "string"
  ]
}
```

**Field description (API-aligned, concise):**

* **application\_id** – The Twinr Application ID for which the push notification should be sent. (You can copy Application\_ID from URL <br>

<figure><img src="/files/sHucSHgHI2qkYZOxYb2k" alt=""><figcaption></figcaption></figure>

* **push\_title** – Title text displayed in the push notification.
* **push\_message** – Body message of the push notification.
* **push\_image** – (Optional) Image URL to be displayed in the notification.
* **click\_action** – Defines the action or screen to open when the user taps the notification.
* **push\_tokens** – List of device tokens that should receive the push notification.

***

4. Map transaction data
5. Test successfully

### Step 7: Publish Zap

* Click **Publish**
* Transaction event notifications are now enabled

***

### Final Notes

* Listing and Transaction Zaps are **optional**
* Each Zap triggers **one push notification**
* Only **published Zaps** will work
* Login Script & Firebase are mandatory


---

# 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://help.twinr.dev/plugins/sharetribe/transaction-related-push-notifications.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.
