Skip to main content
Learn how to integrate with the Yuno Campaigns API to automate personalized communications for declined payment recovery.

Endpoints

Base URL: https://api-sandbox.y.uno/v1

Overview

The Campaigns API allows you to create automated communication campaigns that are triggered when a customer’s payment is declined. When a payment event matches your campaign’s targeting rules, Yuno automatically sends a personalized message to the customer through the configured channel (WhatsApp or phone call), helping recover the failed transaction.

Key concepts

  • Campaign: Defines who to target, through which channel, and when to send communications.
  • Rules: Conditions attached to a campaign that determine which declined payments qualify. All active rules must pass for a payment to trigger the campaign (AND logic).
  • Schedule: Controls the daily time window and timezone for sending communications.
  • Duration: The start and end dates during which the campaign is active.

How it works

Example: You create a campaign targeting declined payments in Colombia with amounts over 50,000 COP. When a Colombian customer’s 80,000 COP payment is declined, Yuno automatically sends them a WhatsApp message with a personalized recovery suggestion.

Authentication

All API requests require the following headers:

Data models

Campaign object

Rule object

Rule types reference

Rules define which declined payments qualify for a campaign. All active rules on a campaign must pass (AND logic) for a communication to be triggered.

Payment data rules

These rules evaluate data directly available from the payment event.

Enriched data rules

These rules evaluate enriched transaction data (payment method, provider, card details, etc.).

Metadata rules

Evaluate custom metadata fields attached to the payment.
Example: Target payments from a specific business vertical:

Rate limiting rules

Control communication frequency to avoid sending too many messages to the same user.
Important notes on rate limiting rules:
  • Both USER_COMMS_PER_DAY and UNIQUE_BY_USER require a user_id field to be present in the payment metadata.
  • USER_COMMS_PER_DAY does not require a conditional field. Only provide values with the daily limit.
  • UNIQUE_BY_USER requires neither values nor conditional. Simply include the rule_type.

Conditional operators reference

Note on BETWEEN with AMOUNT_AND_CURRENCY: When using BETWEEN with AMOUNT_AND_CURRENCY, provide 3 values: ["min", "max", "currency"]. For other rule types, provide 2 values: ["min", "max"].

Getting started

Step 1: Create a campaign

Define who to target, which channel to use, and when communications should be sent.
Note: The campaign is created with ACTIVE status by default. Save the returned id for the next step.

Step 2: Add targeting rules

Define which declined payments should trigger this campaign. Use the campaign id from Step 1.
This campaign will now trigger a WhatsApp message when:
  • Payment status is DECLINED AND
  • Currency is COP AND
  • Amount is greater than 50,000 AND
  • The user has received fewer than 2 communications today

Step 3: Verify your campaign

Confirm the campaign is set up correctly with its rules.

Step 4: Monitor and manage

  • Pause a campaign temporarily: PATCH with {"status": "PAUSED"}
  • Resume a paused campaign: PATCH with {"status": "ACTIVE"}
  • Disable a specific rule without deleting it: PATCH /rules/{rule_id}/status with {"status": "INACTIVE"}
  • End a campaign permanently: PATCH with {"status": "COMPLETED"}

Use case examples

1. Basic declined payment recovery

Send a WhatsApp message to customers in Mexico whose card payments are declined. Campaign:
Rules:

2. High-value transaction recovery via phone call

Call customers whose transactions above 500 USD were declined. Campaign:
Rules:

3. Provider-specific recovery with amount range

Target declined payments from a specific provider within an amount range. Rules:

4. Metadata-based segmentation

Target specific customer segments using payment metadata (e.g., business vertical or customer tier). Rules:

5. Exclude specific response codes

Send recovery messages for all declined payments except those with specific response codes that indicate fraud or permanent issues. Rules:
Note: ISO codes 14 (invalid card number), 43 (stolen card), and 59 (suspected fraud) are excluded since these should not receive recovery communications.

Error handling

All error responses follow a consistent format:

HTTP status codes

Common validation errors