Retention Science - Integration Document

Written By Devin O'Neill ()

Updated at April 16th, 2025

Prerequisites for Installation

Client Name: Retention Science
Site ID: 12345678
Access Token: abc4oXZspQY13eOC6Cu8
Auth Key: NA

Open the Annex Cloud website as shown in the following image:

Provide your Username and Password and click LOGIN on the website's homepage.

Locate the Options icon on the dashboard. It is represented as a gearwheel. Click on it to open the options menu.

The below window appears with an options menu.

Within the options menu, scroll down to find the ESP icon, and click it to access the ESP settings.

Within the ESP settings, click the Retention Science Icon.

Click Add New, which opens a popup where you can input the details of the new user you want to add.

To set the fields in the popup window according to the mandatory parameters for the ESP (Email Service Provider) provided by Annex Cloud, you should populate the fields as follows:

Fields Description
Username Enter the username.
Password Enter the password.
Client ID / Origin ID Enter the client ID provided by Annex Cloud.
Client Secret Enter the client secret provided by Annex Cloud.
Client Identity URL Enter the client Identity URL.
Client Endpoint URL Enter the client endpoint URL.
API Version Enter the client API version.
Refresh Token Enter the refresh token provided by Annex Cloud.
Access Token Enter the access token provided by Annex Cloud.
API Key Enter the API Key provided by Annex Cloud.
Direct Import Site ID Enter the direct import site ID for CSV import provided by Annex Cloud.
Direct Import User ID Enter the direct import user ID for CSV import provided by Annex Cloud.
Direct Import Key Enter the direct import key for CSV import provided by Annex Cloud.

Make sure to fill in each field with the correct information provided by Annex Cloud to establish the connection with your ESP.

After setting all the fields, click Save. It will create the member and will display it in the Configuration section.

There are three icons available in the action tab.

Settings icon: Click the settings icon to Manage the options of the user.

Edit icon: Click the edit icon to edit the user.

Delete icon: Click the delete icon to delete the created user.

Client List:

This section is used to add a new client list, click on the settings icon to open the client list section.

Click the Add Client List to create a new client list.

In the popup that appears, set the following fields:

  • Service: Select the appropriate service from a dropdown menu. (Mandatory Field)
  • Client List Id: Enter the client list ID obtained from the ESP. (Mandatory Field)
  • Client List Name: Enter a name for the client list. (Mandatory Field)
  • Service Event: Select a service event from a dropdown menu (dependent on the Service field).

After filling in all the fields, click the Save button.

The new client list will be added to the Client List section.

Click the delete icon to delete the created member.

Click the edit icon to edit the member.

Click the settings icon to Manage the options of the member.

Client Field:

This section is used to add a new client field.

Click on the edit icon to open the client field section.

Click Add Client Field to create a new client field.

In the popup that appears, set the following fields:

  • Select fields from the AC database to be mapped with the ESP's database field.
  • Map Field Key: Select a field from a dropdown (from the AC database).
  • Field ID: Enter the client field ID obtained from the ESP.

After configuring the above fields, click the Save button to save the client field.

If you need to add more fields, you can click Add More.

Library Implementation

Defaults:

Staging path: https://api.socialannexstaging.com/retentionscience/ReSciAPILibrary.php

Production path: https://api.socialannex.com/retentionscience/ReSciAPILibrary.php

Functions:

createContact($accessToken, $fieldData)

This function is used to add contacts to the retention science database.

Parameters:

Parameter Name Parameter Description Example
$accessToken (required) Enter the Access token provided by the retention science client 9fe13a3cfe4311ed71f6f087f5c1f75159 fb1ff40417a0b8cb3c0b881004

$fieldData

(required)

Pass the field mapping array

Array ( [email] =>

alenmark211114test@gmail.com
 

[opt_in_status] => TRUE

[lifetime_points] => 100

[available_points] => 150 )

APIs

Introduction:

Most e-commerce sites use email as the primary key when identifying a customer. Depending on the primary key determined, every request within the API will need to post respective member information.

Retention Science APIs:

Host: https://api.socialannex.com/

Client Name: Enter the client’s name.

Loyalty - Import Job: POST

Implementation Note:

This API is used to send a welcome email to the member when the member creates an account on the client’s website using the social login.

Request:

Method URL
POST retentionscience/reSciLoyalty.php

Sample Request:

"accessToken": “9fe13a3cfe4311ed71f6f087f5c1f75159fb1ff40417a0b8cb3c0b881004fdcf”
"fields”: "email": “alenmark211114@gmail.com
"opt_in_status": “TRUE”
"lifetime_points":100
"available_points":100
"first_activity_date":"2019-11-27"
"points_to_next_reward":500
"available_rewards":100
"ytd_earned_points":100
"last_purchase_date":"2019-12-27"
"current_tier": “Bronze”
"current_tier_multiplier":1
"customer_id": “3619”
"next_tier": “Silver”
"next_tier_multiplier": “2”
"points_to_next_tier":500,
"tier_after_expiration": “Gold”
"tier_expiration_date":"2019-04-27"
"email": “villasunny.sa123@gmail.com
"opt_in_status": “TRUE”
"lifetime_points":100
"available_points":100
"first_activity_date": “2019-11-27”
"points_to_next_reward":500
"available_rewards":100
"ytd_earned_points":100
"last_purchase_date":"2019-12-27"
"current_tier": “Bronze”
"current_tier_multiplier":1
"customer_id": “3619”
"next_tier": “Silver”
"next_tier_multiplier": “2”
"points_to_next_tier":500
"tier_after_expiration": “Gold”
"tier_expiration_date":"2019-04-29"

Response:

This will return the error code 0 for success.

Positive Response:

Status code Response
200

{

"description": {

"id": 160,

"import_type": "plugin_import",

"status": "pending",

"created_at": "2019-04-09T10:59:52Z",

"updated_at": "2019-04-09T10:59:52Z"

}

}

Notes:

  • Email & Access Token fields are mandatory.
  • Replace email with the member’s email address to whom an email must be sent.
  • Fields array is also mandatory. Need to pass values for all the parameters.
  • All the fields are mapped at the SA site admin. Mention field_id & related values in the given array format while calling the APIs.
  • Using this API call, you can import a single as well as multiple members.

Appendix A

List of definitions (Abbreviations)

Abbreviations Definitions
SEO Search Engine Optimization
API Application Programming Interface 
HLD High-Level Design
AC Annex Cloud
CIM Customer Implementation Management
Auth Key Authentication Key
ESP Email Service Provider
IPM Integration Product Managers
Dev Development Team
SA Site Admin
RAAS Registration As a Service
RAF Refer a Friend
R&R Ratings and Reviews
VC Visual Commerce
SL Social Login
fieldExtName Field Extension Name
msgPref Message preference
customSource Custom Source
SFTP Secure File Transfer Protocol
N.A. Not Applicable

Appendix B

Response Code

Response code/Status codes only show application errors. 10000x codes indicate an error description.

Status Code Definitions Table:

Status code Description
100001 Could not find the data.
100002 Member already exists.
100003 No access token provided.
100004 Request not authorized.
100005 Site ID invalid.
100006 Invalid input parameter.
100007 Email validation failed.
100008 Could not find data for the email.
100009 Could not find data for the ID.
1000010 The member exists with an email.
1000011 Parameters incorrect: sale_amount and order_id are required for purchase actions.
1000012 Action use out of range.
1000013 Cannot award points, reached the limit.
1000014 Duplicate order ID
1000015 The conversion ratio is not set.
1000016 Do not have enough points.
1000018 This product is not eligible for points.
1000021 This order is shipped.
1000022 Invalid status.
1000023 Invalid quantity passed.
1000029 Could not find data for segment ID.
1000031 Store ID invalid.
1000032 Store Level ID invalid
1000033 Parameters incorrect: earned_points or currency_value required.
1000034 Could not find data for product.
1000035 Rewards not eligible for email.
1000036 This order has been returned.
1000037 Action is disabled.
1000038 Available points are fewer so cannot remove points
1000039 Points awarded for OrderID already. Please enter a different OrderID
1000040 Opt-out member.
1000041 earned_points cannot be blank.
1000042 currency_value cannot be blank.
1000043 Invalid user ID for getting action points.
1000044 Action ID / Action Use Not Found
1000045 Duplicate request
1000046 This order is canceled.
1000047 This Endpoint is disabled.
1000048 The member already linked with this phone no
1000049 Invalid User ID provided.
1000050 Order must ship before the return.
1000051 Invalid hold points days.