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


This page assumes that you are finished with the following:

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 and ShowLatestOffer are methods of the TPPersonalizedOffer module.

  • TPPersonalizedOffer is a module for retrieving TentuPlay in-app messages and AI In-Game Shop offers

Request a message

  1. Call ShowOfferById or ShowLatestOffer by using TPPersonalizedOffer module’s function as shown in the code example.

    Code example
    local ReplicatedStorage = game:GetService("ReplicatedStorage")
    local TentuplaySDKModules = ReplicatedStorage["tentuplay-sdk-modules-ReplicatedStorage"]
    local TPPersonalizedOffer = require(TentuplaySDKModules.TPPersonalizedOffer)
    function showPersonalizedOffer()
    	while true do
    		local response = TPPersonalizedOffer.GetOffersAsync(player.UserId)
    		for _, offer in pairs(response) do
    			local offerByIdCallback = TPPersonalizedOffer.ShowOfferById(player.UserId,"EN", offer.offer_id)
    local personalizedOfferCoroutine = coroutine.create(showPersonalizedOffer)
  2. Now, the message appears on the screen