This article will provide a guide detailing how to automate Return to Sender (RTS) events for supporter profiles.
Prerequisites
- A user with access to the Jumbo Lottery Platform with Customer communication RTS role capability enabled.
API Authentication
Before you can upload a file for processing, you need to authenticate the API user.
URL
POST: api.{your-jlp-website}/api-admin/loginHeader
"accept: application/json" "Content-Type: application/json"
Request Body
{
"username": "yourusername",
"password": "yourpassword"
}Response
200 Success Response
If valid credentials are provided, you will get a 200 success response. Most of the information can be ignored; the critical information you need to store is the “access_token” and “refresh_token”.
{
"messages": [],
"result": {
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6..truncated..lOk8gfh6HcwaQ",
"refresh_token": "509bd88d-6177-4536-bdbd-64e242b677ee",
"admin": {
"capabilities": [
"customer.communication_rts"
],
"channels": [
{
"channel_key": "charity_lotery",
"channel_name": "Charity Lottery",
"is_default": true
}
],
"email": "useremail@example.com",
"id": "AAAA-BBBB-CCCC-DDDD",
"name": "User Name"
}
}
}401 Unauthorized
If the wrong credentials are provided, you will get a 401 response. If you get this response, check the credentials and try again.
{
"messages": [
{
"code": "incorrect_details",
"level": "error",
"message": "Username or password is incorrect."
}
]
}Example Curl
curl -X POST "https://api.{your-jlp-website}/api-admin/login" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"password\":\"yourpassword\",\"username\":\"yourusername\"}"Return to Sender Customer Event
Once you have authentication credentials, you are ready to automate a Return to Sender event for a relevant supporter.
URL
POST: api.{your-jlp-website}/api-admin/customer/{customer_encoded_id}/communication/rtsHeader
You will need to pass the access_token fetched as part of the authentication step to authorise this request.
"accept: application/json"
"Content-Type: multipart/form-data"
"Authorization: Bearer {{access_token}}"Response
202 Accepted
If the file is successfully uploaded, you will get a 202 response with the number of “records” accepted in the response body. You can use the “results” value as a final check to confirm that all records have been uploaded.
{"result":true,"messages":[]}Example CURL
curl -X POST https://api.{your-jlp-website}/api-admin/customer/{customer_encoded_id}/communication/rts \ -H "accept: application/json" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer {{access_token}}