(Bulk) Issue Promotion to Customers

Direct issue promotions, also known as LOYALTY promotions in the backend, are a type of promotion where a specific promotion is initially issued to customers based on their behavioural events or transactions. Subsequently, upon meeting the criteria defined in the promotion during their next transaction, the benefits are provided.

This API allows you to issue bulk promotions directly to the customers (the customer earns the promotion). You can also use this API to issue a single promotion.

Terminologies

The table below highlights backend terminologies and their corresponding terms used in the UI/frontend:

UI/Frontend terminologyBackend terminologyDescription
EnrolIssueThe customer is enrolled into a promotion.
IssueEarnThe customer completes the required activity to earn the promotion. Once the promotion is earned, the customer can fulfil the criteria to receive the associated benefits.

API endpoint example

https://eucrm.cc.capillarytech.com/v2/promotion/bulk/directEarn

Prerequisites

  • Authentication - Basic or OAuth authentication
  • Access group resource - Write access to customer group resource

Resource information

URI/v2/promotion/bulk/directEarn
HTTP methodPOST
Pagination supported?NA
Rate limitNA
Batch supportNA

Body parameters

ParameterData TypeDescription
typeEnumIndicates the entity type. Only the "CUSTOMER" entity is supported (Case sensitive).
promotionDetailsObjectDetails of the promotion to enroll the customer in.
programIdIntegerThe ID of the loyalty program.
promotionIdIntegerThe ID of the specific promotion.
identifierNameStringThe identifier type for the customer. Supported identifiers: "id" (customer ID), "mobile", and "email".
customersArrayList of customers on whom the action will be performed.
NOTE: To set a limit on the number of customers that can be added to a promotion, you need to enable the Bulk API Redirection feature. To do this, set BULK_API_REDIRECTION_ENABLED to true. You can then configure the batch size using the BULK_API_BATCH_SIZE_FOR_REDIRECTION environment variable. If not set, the default batch size is 10, meaning up to 10 customers can be added to the same promotion.

If BULK_API_REDIRECTION_ENABLED is disabled, there is no limit on the number of customers in the request.
identifierValueStringThe specific identifier value for the identifier type defined in theidentifierName.
sourceEnumThe source of the customer's registration, e.g., "INSTORE".
{
    "type" : "CUSTOMER",
    "promotionDetails" : {
       "programId": 469, 
       "promotionId":56799
    },
    "identifierName":"id",
    "customers":
    [  
        {
            "identifierValue":"98662653",
            "source":"INSTORE"
        },
        {
            "identifierValue":"98662632",
            "source":"INSTORE"
        } 
    ]
}

Response parameters

ParameterData TypeDescription
responseArrayA list of responses for each processed entity.
resultObjectThe result details for the entity.
entityTypeStringThe type of entity.
entityIdIntegerThe ID of the entity.
promotionIdIntegerThe ID of the promotion associated with the entity.
promotionNameStringThe name of the promotion.
programIdIntegerThe ID of the program associated with the promotion.
issualIdIntegerThis ID is not applicable for direct issue promotion. This is for backend use.
earnedIdIntegerUnique ID generated when a promotion is issued a promotion.
errorsArrayA list of errors, if any, for the processed entity.
warningsArrayA list of warnings, if any, for the processed entity.
totalCountIntegerThe total number of entities processed.
failureCountIntegerThe total number of entities that failed to process.
{
    "response": [
        {
            "result": {
                "entityType": "CUSTOMER",
                "entityId": 423924812,
                "promotionId": 201436,
                "programId": 2750,
                "issualId": "811",
                "earnedId": "765"
            },
            "errors": [],
            "warnings": []
        }
    ],
    "totalCount": 1,
    "failureCount": 0
}
{
    "response": [
        {
            "errors": [
                {
                    "status": false,
                    "code": 8892,
                    "message": "promotion is inactive"
                }
            ],
            "warnings": []
        }
    ],
    "totalCount": 1,
    "failureCount": 1
}
{
    "response": [
        {
            "errors": [
                {
                    "status": false,
                    "code": 8015,
                    "message": "Customer not found for the given identifiers"
                }
            ],
            "warnings": []
        }
    ],
    "totalCount": 1,
    "failureCount": 1
}
{
    "response": [
        {
            "errors": [
                {
                    "status": false,
                    "code": 1101,
                    "message": "invalid programId passed"
                }
            ],
            "warnings": []
        }
    ],
    "totalCount": 1,
    "failureCount": 1
}
{
    "response": [
        {
            "errors": [
                {
                    "status": false,
                    "code": 8874,
                    "message": "promotion id passed is invalid"
                }
            ],
            "warnings": []
        }
    ],
    "totalCount": 1,
    "failureCount": 1
}
{
    "response": [
        {
            "errors": [
                {
                    "status": false,
                    "code": 8899,
                    "message": "Cannot enrol/issue to the user group"
                }
            ],
            "warnings": []
        }
    ],
    "totalCount": 1,
    "failureCount": 1
}
{
    "response": [
        {
            "errors": [
                {
                    "status": false,
                    "code": 8881,
                    "message": "insufficient parameters passed, program id and one of promotion id/identifier are required"
                }
            ],
            "warnings": []
        }
    ],
    "totalCount": 1,
    "failureCount": 1
}
{
    "response": [
        {
            "errors": [
                {
                    "status": false,
                    "code": 8881,
                    "message": "insufficient parameters passed, program id and one of promotion id/identifier are required"
                }
            ],
            "warnings": []
        }
    ],
    "totalCount": 1,
    "failureCount": 1
}
{
    "response": [
        {
            "result": {
                "entityType": "CUSTOMER",
                "entityId": 387004879,
                "promoIdentifier": "Promo_testMay13",
                "programId": 2607,
                "issualId":"101",
                "earnedId": "78"
            },
            "errors": [],
            "warnings": []
        },
        {
          "result": {
                "entityType": "CUSTOMER",
                "entityId": 387004879,
                "promoIdentifier": "Promo_testMay13",
                "programId": 2607,
                "issualId":"101",
                "earnedId": "79"
            },
            "errors": [],
            "warnings": []
        },
        {
         "result": {
                "entityType": "CUSTOMER",
                "entityId": 423815857,
                "promotionId": 200206,
                "programId": 2844
            },
            "errors": [],
            "warnings": [
                {
                    "status": false,
                    "code": 8890,
                    "message": "promotion not issued due to config issues or customer exhausted limits"
                }
            ]
        }
    ],
    "totalCount": 3,
    "failureCount": 0
}

API-specific error codes

Error CodeDescription
8892Promotion is inactive
8015Customer not found for the given identifiers
1101Invalid programId passed
8874Promotion ID passed is invalid
8899Cannot enrol/issue to the user group. This happens when you define USERGROUP2 as the entity.
8881Insufficient parameters passed; program ID and one of the promotion ID/identifiers are required

API-specific warning codes

Warning CodeDescription
8890Promotion not issued due to config issues or customer exhausted limits
Language
Credentials
Basic
base64
:
URL
Click Try It! to start a request and see the response here!