Skip to main content

Promotion API Examples

This document provides practical examples of using the Main App Promotion API for common use cases.

Basic Queries​

Fetch All Promotions​

query GetAllPromotions {
promotions(limit: 10, offset: 0) {
count
data {
id
name
description
slug
category
type
imageUrl
altText
primaryButton {
text
action {
modal
externalUrl
internalUrl
}
}
seo {
title
description
socialImage
}
isClaimed
isClicked
usersClaimed {
count
sampleUsers {
id
avatarUrl
}
}
}
limit
offset
}
}

Fetch Single Promotion by Slug​

query GetPromotionBySlug($slug: String!) {
promotion(slug: $slug) {
id
name
description
slug
category
type
imageUrl
altText
backgroundColor
primaryButton {
text
action {
modal
externalUrl
internalUrl
}
}
secondaryButton {
action {
modal
externalUrl
internalUrl
}
}
howItWorks {
steps
longDescription
terms
}
seo {
title
description
socialImage
}
slider {
name
title
description
imageUrl
btnText
link
actionType
initialClickCount
}
popup {
name
title
description
imageUrl
btnText
link
actionType
layout
initialClickCount
}
videoSlider {
name
title
description
videoUrl
btnText
link
actionType
initialClickCount
}
isClaimed
isClicked
usersClaimed {
count
sampleUsers {
id
avatarUrl
}
}
remainedSecondsToOptIn
}
}

Filtered Queries​

Fetch Casino Promotions​

query GetCasinoPromotions {
promotions(
category: CASINO
limit: 5
offset: 0
order: DESC
orderBy: CREATED_AT
) {
count
data {
id
name
description
category
imageUrl
primaryButton {
text
action {
modal
}
}
isClaimed
}
limit
offset
}
}

Fetch Big Promotions Only​

query GetBigPromotions {
promotions(type: BIG, limit: 3, offset: 0) {
count
data {
id
name
description
type
howItWorks {
steps
longDescription
terms
}
secondaryButton {
action {
modal
}
}
}
}
}

Slider Queries​

Fetch Home Page Sliders​

query GetHomeSliders {
sliders(
category: CASINO
sliderCategory: HOME_PAGE
limit: 5
offset: 0
order: ASC
) {
count
data {
id
name
description
slug
slider {
name
title
description
imageUrl
btnText
link
actionType
initialClickCount
}
primaryButton {
text
action {
modal
}
}
isClaimed
isClicked
}
limit
offset
}
}

Fetch Casino Lobby Sliders​

query GetCasinoLobbySliders {
sliders(
category: CASINO
sliderCategory: CASINO_LOBBY
limit: 10
offset: 0
) {
count
data {
id
slug
slider {
title
description
imageUrl
actionType
initialClickCount
}
isClaimed
}
}
}

Fetch Active Popups​

query GetActivePopups {
popups(category: CASINO, popupCategory: POPUP, limit: 3, offset: 0) {
count
data {
id
name
description
popup {
name
title
description
imageUrl
btnText
link
actionType
layout
initialClickCount
}
primaryButton {
text
action {
modal
}
}
isClaimed
}
}
}

Fetch Notification Popups​

query GetNotificationPopups {
popups(category: GENERAL, popupCategory: NOTIFICATION, limit: 5, offset: 0) {
count
data {
id
popup {
title
description
layout
actionType
}
primaryButton {
text
action {
modal
}
}
}
}
}

Video Slider Queries​

Fetch Casino Explore Videos​

query GetCasinoExploreVideos {
videoSliders(
category: CASINO
videoSliderCategory: CASINO_EXPLORE
limit: 4
offset: 0
) {
count
data {
id
name
description
videoSlider {
name
title
description
videoUrl
btnText
link
actionType
initialClickCount
}
primaryButton {
text
action {
modal
}
}
isClaimed
isClicked
}
}
}

Fetch Sports Explore Videos​

query GetSportsExploreVideos {
videoSliders(
category: SPORTS
videoSliderCategory: SPORTS_EXPLORE
limit: 3
offset: 0
) {
count
data {
id
videoSlider {
title
description
videoUrl
actionType
}
isClaimed
}
}
}

User Interaction Examples​

Check if User Claimed Promotion​

query CheckUserClaim($slug: String!) {
promotion(slug: $slug) {
id
name
isClaimed
primaryButton {
text
action {
modal
}
}
remainedSecondsToOptIn
}
}

Get User Engagement Data​

query GetEngagementData($slug: String!) {
promotion(slug: $slug) {
id
name
isClaimed
isClicked
usersClaimed {
count
sampleUsers {
id
avatarUrl
}
}
slider {
initialClickCount
}
popup {
initialClickCount
}
videoSlider {
initialClickCount
}
}
}

Device-Specific Queries​

Mobile-Optimized Query​

query GetMobilePromotions {
promotions(
limit: 5
offset: 0
userAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15"
) {
count
data {
id
name
description
imageUrl
altText
primaryButton {
text
action {
modal
}
}
isClaimed
}
}
}

Desktop-Optimized Query​

query GetDesktopPromotions {
promotions(
limit: 10
offset: 0
userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
) {
count
data {
id
name
description
imageUrl
howItWorks {
steps
longDescription
}
secondaryButton {
action {
modal
}
}
isClaimed
}
}
}

Pagination Examples​

First Page​

query GetFirstPage {
promotions(limit: 10, offset: 0) {
count
data {
id
name
description
}
limit
offset
}
}

Second Page​

query GetSecondPage {
promotions(limit: 10, offset: 10) {
count
data {
id
name
description
}
limit
offset
}
}

Large Page Size​

query GetLargePage {
promotions(limit: 50, offset: 0) {
count
data {
id
name
category
type
}
limit
offset
}
}

Sorting Examples​

Sort by Creation Date (Newest First)​

query GetNewestPromotions {
promotions(limit: 10, offset: 0, order: DESC, orderBy: CREATED_AT) {
count
data {
id
name
description
createdAt
}
}
}

Sort by Update Date (Recently Updated)​

query GetRecentlyUpdated {
promotions(limit: 10, offset: 0, order: DESC, orderBy: UPDATED_AT) {
count
data {
id
name
description
updatedAt
}
}
}

Complex Filtering​

Multi-Category Query​

query GetMultiCategoryPromotions {
casinoPromotions: promotions(category: CASINO, limit: 5) {
count
data {
id
name
category
}
}

sportsPromotions: promotions(category: SPORTS, limit: 5) {
count
data {
id
name
category
}
}

generalPromotions: promotions(category: GENERAL, limit: 5) {
count
data {
id
name
category
}
}
}

Content Type Specific Query​

query GetAllContentTypes($category: PromotionCategory!) {
promotions: promotions(category: $category, limit: 5) {
count
data {
id
name
type
}
}

sliders: sliders(category: $category, sliderCategory: HOME_PAGE, limit: 5) {
count
data {
id
name
slider {
title
actionType
}
}
}

popups: popups(category: $category, popupCategory: POPUP, limit: 5) {
count
data {
id
name
popup {
title
layout
}
}
}

videoSliders: videoSliders(
category: $category
videoSliderCategory: CASINO_EXPLORE
limit: 5
) {
count
data {
id
name
videoSlider {
title
actionType
}
}
}
}

Error Handling Examples​

Handle Non-Existent Promotion​

query GetPromotionSafely($slug: String!) {
promotion(slug: $slug) {
id
name
description
}
}

Response for non-existent promotion:

{
"data": {
"promotion": null
}
}

Handle Empty Results​

query GetPromotionsWithFallback {
promotions(category: CASINO, limit: 10) {
count
data {
id
name
description
}
}
}

Response for no results:

{
"data": {
"promotions": {
"count": 0,
"data": []
}
}
}

Performance Optimization Examples​

Minimal Field Query​

query GetMinimalPromotions {
promotions(limit: 20) {
count
data {
id
name
slug
category
isClaimed
}
}
}

Selective Field Query​

query GetPromotionPreview($slug: String!) {
promotion(slug: $slug) {
id
name
description
imageUrl
altText
primaryButton {
text
action {
modal
}
}
isClaimed
}
}

Real-World Use Cases​

Homepage Promotion Display​

query GetHomepageContent {
featuredPromotions: promotions(
category: CASINO
type: BIG
limit: 3
order: DESC
orderBy: CREATED_AT
) {
data {
id
name
description
imageUrl
altText
primaryButton {
text
action {
modal
}
}
isClaimed
}
}

homeSliders: sliders(category: CASINO, sliderCategory: HOME_PAGE, limit: 5) {
data {
id
slider {
title
description
imageUrl
actionType
btnText
link
}
isClaimed
}
}
}

User Profile Promotions​

query GetUserPromotions {
availablePromotions: promotions(category: CASINO, limit: 10) {
data {
id
name
description
imageUrl
primaryButton {
text
action {
modal
}
}
isClaimed
remainedSecondsToOptIn
}
}
}

Promotional Popup System​

query GetActivePopups {
urgentPopups: popups(
category: GENERAL
popupCategory: NOTIFICATION
limit: 1
) {
data {
id
popup {
title
description
layout
actionType
btnText
link
}
primaryButton {
text
action {
modal
}
}
isClaimed
}
}
}