-
-
Save sendbird-community/e2d5f9057473b5fde6e16807551af383 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getAgentsSendbirdCreds: function (user) { | |
//Installation parameters protect Sendbird's API tokn - https://developers.freshdesk.com/v2/docs/installation-parameters/ | |
//Headers here use templating to pick up the iparam.api_token - https://developers.freshdesk.com/v2/docs/request-method/#sample_requests | |
//See iparam.json for the settings | |
//Here the api-token is hard coded - don't use this approach in production. | |
$request.get(`https://api-${APP_ID}.sendbird.com/v3/users/${user.sendbirdUserId}` , {headers}) | |
.then( | |
function (data) { | |
//handle "data" | |
//"data" is a json string with status, headers, and response. | |
renderData(null, data) | |
}, | |
function (error) { | |
// var error = { status: 403, message: "Error while processing the request" }; | |
renderData({message: JSON.stringify(error)}); | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment