Coupon Code - UNEXO icon

Coupon Code - UNEXO

Node for Voucher

Overview

This node interacts with a voucher (coupon) system to retrieve batches of vouchers associated with specified users and a selected coupon pool. It is useful in scenarios where you want to assign or fetch voucher codes for users from predefined voucher pools, such as promotional campaigns, loyalty programs, or targeted discounts.

For example, if you have a list of users and want to obtain their corresponding vouchers from a specific coupon pool, this node will send the request to the external voucher service and return the vouchers assigned to those users.

Properties

Name Meaning
Coupon Pool Name Select a voucher pool from a dynamically loaded list of available coupon pools.
Users A string representing users; if left blank, the node uses users from the previous node's output.

Output

The node outputs a JSON array containing the response from the external voucher service. This response includes voucher information for each user and the selected coupon pool. The exact structure depends on the external API but generally contains voucher codes and related metadata.

No binary data output is produced by this node.

Dependencies

  • Requires an external voucher service accessible via HTTP API.
  • Needs environment variables configured:
    • CDP_URL: Base URL of the voucher service API.
    • UNEXO_API_KEY: API key used for authorization in requests.
  • The node makes authenticated GET and POST requests to endpoints under /api/voucherPools/.

Troubleshooting

  • Common issues:

    • Missing or incorrect environment variables (CDP_URL or UNEXO_API_KEY) will cause authentication or connection failures.
    • If the "Coupon Pool Name" is not selected or invalid, the API may return errors or empty results.
    • Providing malformed or missing user identifiers can lead to incomplete voucher retrieval.
  • Error messages:

    • Authorization errors typically indicate an invalid or expired API key.
    • Network errors suggest connectivity problems with the voucher service.
    • API response errors might occur if the voucher pool name does not exist or the request body is malformed.
  • Resolutions:

    • Verify that environment variables are correctly set in n8n.
    • Ensure the selected coupon pool exists and is spelled correctly.
    • Confirm that user data passed to the node is valid and properly formatted.

Links and References

  • No direct links provided in the source code.
  • Refer to your voucher service API documentation for details on /api/voucherPools/listVoucherPoolTitles and /api/voucherPools/getVouchersBatch endpoints.

Discussion