Client API Proxy
All operations documented within the Server APIs are designed to give an administrative level of access to data; as such, the data and operations tend not to be user specific. What does this mean?
- You will see a global perspective of Messages; this means that properties such as
received_atwhich are specific to individual users can’t be part of the results as each user has their own
- You will see a global perspective of Conversations; this means that properties such as
last_messagewhich may vary among users. This is especially true for those who have done a
DELETEoperation removing it using
mode=all_participants, gaurenteeing differences in Message lists and
Sometimes however, its useful to be able to view data from the perspective of a specific user, and even perform actions on that user’s behalf. Some examples include:
- Get the user’s message list, process it, and then deliver it to the user
- Send a Message or Read Receipt on behalf of the user
- Delete data that is no longer relevant to this user
The Client API Proxy allows the Server API to route authenticated requests to the Client API. Why not just use the Client API directly? Because authentication with the Server API is done using a single Bearer Token; each user needs a separate session token to access their data via the Client API, which can result in a lot of runs through Layer’s authentication process to manage a large user group.
Requests sent to
https://api.layer.com/apps/YOUR_APP_ID/users/USER_ID/endpoint will be treated as a Client API Proxy request.
User management requests use the same URL, and are not sent to the Client API; any request you see in the Server API’s User Management will be handled by the Server API.
To understand what requests are possible, and learn about the API for these requests, see the Client API Reference.
Examples are below:
This request will return an array of Conversations that the user has access to.
This request will send a Message on behalf of the user
This request will send a Read/Delivery Receipt on behalf of the user
This request will delete a Message on behalf of the user