Retrieve messages
This page gives information about how to get an in-app message from TentuPlay database. You will learn the following:
-
The prerequisites that are required
-
Module, classes, and methods that are applicable
-
How to get an in-app message data
Prerequisites
This page assumes that you are finished with the following:
-
You have created a TentuPlay account and a project in console.
-
You have configured your roblox game and TentuPlay plugin.
-
You have completed the configuration for data collection and upload.
Module, class, and methods in use
When ShowOfferById
or ShowLatestOffer
is called, TPPersonalizedOffer module will dynamically retrieve offers by player (namely, userId) and returns you the data table for your use.
-
ShowOfferById
andShowLatestOffer
are methods of theTPPersonalizedOffer
module. -
TPPersonalizedOffer
is a module for retrieving TentuPlay in-app messages and AI In-Game Shop offers
Request a message
-
Call
ShowOfferById
orShowLatestOffer
by usingTPPersonalizedOffer
module’s function as shown in the code example.Code examplelocal ReplicatedStorage = game:GetService("ReplicatedStorage") local TentuplaySDKModules = ReplicatedStorage["tentuplay-sdk-modules-ReplicatedStorage"] local TPPersonalizedOffer = require(TentuplaySDKModules.TPPersonalizedOffer) function showPersonalizedOffer() while true do wait(5) local response = TPPersonalizedOffer.GetOffersAsync(player.UserId) for _, offer in pairs(response) do local offerByIdCallback = TPPersonalizedOffer.ShowOfferById(player.UserId,"EN", offer.offer_id) end end end local personalizedOfferCoroutine = coroutine.create(showPersonalizedOffer) coroutine.resume(personalizedOfferCoroutine)
-
Now, the message appears on the screen