Skip to main content

Messenger API

Updated over 3 months ago

The Messenger API, our original messages endpoint, delivers personalized notifications about upcoming goals. Its purpose is to remind users of how much time they have left to complete their next game goal. These timely messages motivate players to stay active, helping them earn rewards and stay engaged.


Preparing to connect

Follow these steps to prepare to connect to Besitos APIs:

  1. Have your partner ID ready.

  2. Contact your Besitos Account Manager to request API access.

  3. Generate and save your bearer token for authentication.

Continue reading for a complete description of the API parameters and response attributes, or visit our Postman collection to start testing.


Endpoint

Endpoint URL

https://wall.besitos.ai/data/messages/{partner_id}/upcoming-goals

HTTP method

POST

Path parameter

Path parameter

Data type

Required

Description

partner_id

string

yes

Your Besitos partner ID.

Supported filters

To filter the response, you can include optional POST parameters in the request body. Here are some examples of how and why you might use these parameters:

  • Return messages related to goals for users whose IDs you include in the subscribers parameter

  • Return messages for goals with the hours specified in the hours_from and hours_to parameters

  • Return messages for specific offers with the offers parameter

The entire dataset will be returned if you do not use these parameters.

Parameter

Data type

Required

Description and example

subscribers

array

no

Returns all goals for each user ID you include in the array.

If you do not include a user ID(s), all available goals for every user on your account will be returned.

Example: 21sdf1sef54wef64

offers

array

no

Returns all goals for each offer ID included in the array.

If you do not include any offer ID(s), all goals for all offers in your account will be returned.

Example: rYZv23fgqfSN

hours_from

integer

no

Returns all goals for each offer ID included in the array.

If you do not include any offer ID(s), all goals for every offer in your account will be returned.

Example: 10

hours_to

integer

no

This value marks the end of a range that returns all goals with the specified hours remaining.

If you do not specify a number, all goals with up to 48 hours remaining will be returned.

Example: 41

message_template

string

no

With this filter, you can modify the following message variables: hours, level, game, and reward.

If you omit the "message_template," the default message will be returned.

Example of default message:

Reminder: You have [#] hours left to reach [level] of [game] and earn [reward]. Don’t miss the deadline.

Examples

Request

$apiUrl = 'https://wall.besitos.ai/data/messages/{partnerID}/upcoming-goals';
$accessToken = 'your_bearer_access_token';
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $apiUrl,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"subscribers": [
"LaQ1VYb5ANTAny25Ig",
"21sdf1sef54wef64"
],
"offers": [
"rYZvzXlCqfSN",
"rYZv23fgqfSN"
],
"hours_from": 24,
"hours_to": 120,
"message_template":"You have {hours} hours left to reach {level} of {game} and earn {reward}. Don\'t miss the deadline."
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Bearer ' . $accessToken
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;

Response

{
"current_page": 1,
"data": [
{
"subscriber_id": "LaQ1VYb5ANTAny25Ig",
"game": "Alice‘s Dream : Merge Island",
"level": "level 1079",
"level_description": "Reach Level 15",
"hours": 3,
"currency": "coins",
"reward": "40 coins",
"message": "You have 3 hours left to reach level 1079 of Alice‘s Dream : Merge Island and earn 40 coins. Don't miss the deadline."
},
{
"subscriber_id": "LaQ1VYb5ANTAny25Ig",
"game": "Alice‘s Dream : Merge Island",
"level": "level 1081",
"level_description": "Reach Level 20",
"hours": 291,
"currency": "coins",
"reward": "80 coins",
"message": "You have 291 hours left to reach level 1081 of Alice‘s Dream : Merge Island and earn 80 coins. Don't miss the deadline."
}
],
"first_page_url": "http://besitos-service.test/data/messages/eafLst9T/upcoming-goals?page=1",
"from": 1,
"next_page_url": null,
"path": "http://besitos-service.test/data/messages/eafLst9T/upcoming-goals",
"per_page": "2",
"prev_page_url": null,
"to": 2
}


Response attributes

Attributes

Type

Description

Example

subscriber_id

string

The unique identifier of the user.

"LaQ1VYb5ANTAny25Ig"

game

string

The name of the game.

"Alice‘s Dream : Merge Island"

level

string

The current or target level (contains text and number).

"level 1079"

level_description

string

A description of the goal in the offer.

"Reach Level 15"

hours

integer

Hours remaining to achieve the goal, calculated from the “install” goal; the countdown begins once a user installs the game app.

3

currency

string

Your (partner) currency (points, dollars, etc.).

"coins"

reward

string

The user’s reward for reaching the upcoming goal.

"40 coins"

message

string

The message for the upcoming goal.

"You have 3 hours left to reach level 1079 of Alice‘s Dream : Merge Island and earn 40 coins. Don't miss the deadline."

For help, contact your Besitos Account Manager or our Implementation Team at [email protected] or via your project channel in Slack.

Did this answer your question?