ClickCease

Load Balancing

The load balancer helps you manage multiple accounts. It uses a randomized round robin in order to send requests to various accounts attached to TNL.

To use the load balancer, you send imagine, describe or message to the loadBalancerendpoint.

POST/GET
https://api.thenextleg.io/loadBalancer/<message|imagine|button|describe>

Request Body

Imagine

You use the same parameters as in imagine. You can use any authToken that is part of your account.

Button

As part of the button request, you will need to send the loadBalanceId inside of the request body
0 1 2 3 4 { "button": "V1", "buttonMessageId": "<button-message-id>", "loadBalanceId": "<load-balance-id>>" }

HTTP Response

200Success

Your response will return a messageId. Use the messageId at the GET Message endpoint to poll for results, or to you can wait for the result to arrive via webhook.

0 1 2 3 4 5 6 { "success": true, "messageId": "your-message-id", "createdAt": "2023-04-04T13:07:01.927Z", "loadBalanceId": "your-load-balance-id", "accountId": "your-account-id", }

Getting a Message

In order to get a message, you just need to append the loadBalanceId as a query parameter to the getMessages endpoint.
GET
https://api.thenextleg.io/loadBalancer/message/<messageId>?loadBalanceId=loadBalanceId