# 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**

![](https://help.twinr.dev/assets/Screenshot%202026-01-16%20at%205.52.22%E2%80%AFPM.png)

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

![](https://help.twinr.dev/assets/Screenshot%202026-01-16%20at%205.53.08%E2%80%AFPM.png)

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**

> **Tip:** [https://msengageapi.twinr.dev/v3/send-notifications](https://msengageapi.twinr.dev/v3/send-notifications)

#### Headers

The endpoint authenticates with an account secret. Under **Headers**, add:

| Key | Value |
| --- | --- |
| `Authorization` | `Bearer twnr_live_...` |

Create the secret at **My Profile → Account secrets**, scoped to this app. It is shown once, when you create it — copy it before closing the dialog. See [Account Secrets](https://help.twinr.dev/twinr-account/account-secrets).

> **Warning:** Anyone holding the secret can send notifications that appear to come from your app. It belongs in Zapier and on your own servers, never in a web page.

#### 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** – Your Twinr app ID. Map it from **Show User → Metadata → app\_id** (Step 4), or copy it from the address bar when your app is open in the [Twinr Builder](https://builder.twinr.dev/). Required.
* **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. Map it from **Show User → Metadata → device\_push\_token** (Step 4).

***

4. Map transaction data
5. Test successfully

### Step 7: Publish Zap

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

***

### Alternative: Store the Token Yourself

By default, Twinr writes the device token to the user's Sharetribe profile metadata, and the Zap reads it with **Show User**. If you prefer to manage the token yourself, call `twinr_push_token_fetch()` on your marketplace page and save the returned `token` to the user's own profile data in your own code. Then map that field in the Zap instead of `metadata.device_push_token`. See [Push Notification - Device Token](https://help.twinr.dev/js-bridge/push-notification-device-token).

Twinr writes the token for you only when your app is built with the latest Twinr version and has a paid app subscription. The JS bridge needs [Personalized Push Notification](https://help.twinr.dev/push/personalized-push-notification) 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

Source: https://help.twinr.dev/plugins/sharetribe/transaction-related-push-notifications
