POST getOffers

{{domainAddress}}/campaigns/getOffers

This function will return a list of campaign offers that will be displayed as cars on the mobile apps’ Promotions & Offers UI.

Revisions:

  • On March 30, 2020, we:
    • updated the response object description to match that returned in the as-built API;
    • added a new property in each offer’s data object: appUIs, which is an array that includes the applicable promo code input screens for a particular offer.
  • On July 1, 2024, we altered the required headers for each post. Please see the updated documentation for authentication.

Headers

HeaderContent
Content Typeapplication/json
AuthorizationBearer {{ID token}}
App-Id{{API key provided by Mosaic}}
Device-Id{{Advertising ID from the initial installation of this app}}
Request-Date{{ISO 8601 date and time format in UTC}}

Body

Variable Contents
ParameterDescription
{{clientId}} Is provided by CWF for the app project and will be consistent throughout all API calls that require this ID.
Type: String; Required
{
    "clientId":"{{clientId}}",
}

Example

Headers
App-Id: 5***9-d**3-4**8-b**1-b3***dac
Device-Id: a4***cb-d***5-4***f-8***c-84***75
Request-Date: 2024-07-02T19:59:20.815Z
Content-Type: application/json
Authorization: Bearer eyJraWQiO...aLxlc6PCgQ
Body
{
    "clientId":"1f6w1jh6ls3mb"
}

Response

{
    "errors": [],
    "warnings": [],
    "notices": [],
    "data": {
        "offers": [
            {
                "activatedBy": "3132067a-1105-4961-bd73-e3eefec65b6e",
                "active": true,
                "activationDate": 1585003425748,
                "data": {
                    "offer": true,
                    "adminUI": "trigger",
                    "notification": {...},
                    "offerDetails": {
                        "type": "social-share",
                        "cta": "SHARE APP",
                        "ctaIcon": "forward-arrow",
                        "shareMessage": {
                            "construct": [
                                "messageA",
                                "appLink",
                                "messageB",
                                "promoCode",
                                "messageC"
                            ],
                            "appLink": "wearemosaic.ca",
                            "messageA": "I've been loving the Mosaic Development App! Download the app here: ",
                            "messageB": " and use promo code: ",
                            "messageC": " to register for a new account and receive 3000 loyalty points."
                        }
                    },
                    "criteria": [...],
                    "name": "Loyalty 200:3000 Dual Reward",
                    "description": "Enjoying the app? Share it with friends, and for every new signup, you'll receive 200 loyalty points, and your friends will get enough points for a free wash.",
                    "appUIs": [
                        "register",
                        "profile"
                    ],
                    "promoCode": {... },
                    "participating": [...],
                    "type": "triggered_reward",
                    "rewards": {...}
                },
                "archive": false,
                "deactivationDate": 0,
                "offer": true,
                "name": "Loyalty 200:3000 Dual Reward",
                "campaignId": "2r05q7k850pl19",
                "clientId": "d7dkq1jnxfa52o",
                "type": "promo_code"
            },
            {
                "active": true,
                "data": {
                    "offer": true,
                    "adminUI": "trigger",
                    "notification": {...},
                    "criteria": [... ],
                    "offerDetails": {
                        "type": "social-share",
                        "cta": "SHARE APP",
                        "ctaIcon": "forward-arrow",
                        "shareMessage": {
                            "construct": [
                                "messageA",
                                "appLink",
                                "messageB",
                                "promoCode",
                                "messageC"
                            ],
                            "appLink": "wearemosaic.ca",
                            "messageA": "I've been loving the Mosaic Development App! Download the app here: ",
                            "messageB": " and use promo code: ",
                            "messageC": " to register for a new account."
                        }
                    },
                    "name": "Share the app and receive a free wash",
                    "description": "This is a verbose description of this promotional campaign. Its purpose is to encourage customers to share the app with their friends and followers, and, in return, rewards the sharer AND the new user that accepts it.",
                    "appUIs": [
                        "register",
                        "profile"
                    ],
                    "participating": [...],
                    "promoCode": {... },
                    "type": "triggered_reward",
                    "rewards": {...}
                },
                "offer": true,
                "archive": false,
                "name": "Share the app and receive a free wash",
                "campaignId": "sampleId-000001",
                "clientId": "d7dkq1jnxfa52o",
                "type": "promo_code"
            },
        ]
    }
}

Developer:

If the query was successful (no errors), then each object within the response.data.offers array will represent one card on the Promotions & Offers UI. It is possible that the array will be empty.

Success responses variations

For the initial release of this project, there will be only one type of card displayed in this list—a social share campaign. We will update this document with additional types as they are created.

Applicable Promo Code Input Locations

Not all promo codes campaigns are the same. Some promo codes should be used at registration, or on the user’s profile screen, while others should only be used at the time of checkout.

We’ve included within the data object of each offer, an appUIs array that identifies where this promo code should be used. If a user attempts to use the promo code at the wrong location, a “not applicable” error should be displayed.

appUIs options are “register”, “profile”, or “checkout”.

Call To Action (CTA) contents

The contents of the CTA will vary depending on the type of campaign, and instructions will be provided in the offerDetails object, which can vary depending on the type of campaign:

Social Sharing campaign
A social sharing campaign type can be determined by examining the following two property values:

  • response.data.offers[x].type = "promo-code"
  • response.data.offers[x].offerDetails.type = "social-share"

In the event of a social share offer:

  • the CTA text and icon will be provided in:
    • offerDetails.cta
    • offerDetails.ctaIcon
  • the CTA button will query the API function /promoCode/getMyPromo

Once the promo code is received, the app will have all of the information required in order to create the social share content, which is found in the offerDetails.shareMessage object.

"shareMessage":{
     "construct":[
         "messageA",
         "appLink",
         "messageB",
         "promoCode",
         "messageC"
     ]
     "appLink":"bit.ly/qi341",
     "messageA":"“I’ve been loving the Co-op Carwash App! Download the app here: ",
     "messageB":" and use promo code: ",
     "messageC":" when you register for a new account to receive $10 off your first purchase!”",",
 }

This message contains content that may:

  • need to be uniquely formatted within the message, or
  • contain variable content.

To provide sufficient instruction, we’ve added the "construct" property, that shows the app how to put the separate pieces together to generate the dynamic message that will be shared on social media.

The individual components of the message are included as strings with their own property names.

The construct array demonstrates the sequence in which they need to be appended to create the final message.

In the case above, all of the property names are included in the shareMessage object except the promoCode property. That value must be collected from the /promoCode/getMyPromo response.

Once the promoCode value is collected, the final message would be put together to read:

“I’ve been loving the Co-op Carwash App! Download the app here: bit.ly/qi341 and use promo code: AH40184 when you register for a new account to receive $10 off your first purchase!”