-
-
Save sendbird-community/7bee38400d17b61eab960ea41fe567f1 to your computer and use it in GitHub Desktop.
prepare to gather the ticket details and call to Sendbird for the agent’s Sendbird credentials.
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
const collectDataToPassToModal = async () => { | |
//Get current user/agent's details for fetching Sendbird Credentials and passing to the calls modal. | |
const agentData = await client.data.get('loggedInUser'); //https://developers.freshdesk.com/v2/docs/data-methods/#loggedInUser | |
const ticketCreatorData = await client.data.get('contact'); //https://developers.freshdesk.com/v2/docs/data-methods/#contactAPI | |
//Any unique identifier from the agent can be used in Sendbird. | |
//Additionally, it would be possible at this point to create the user in Sendbird. | |
//Here we only fetch the user but you could try to fetch the user and if that fails create a new user using the server.js functions. | |
const sendbirdUser = await fetchSendbirdUserCredentials(agentData.loggedInUser.org_agent_id) //https://sendbird.com/docs/chat/v3/platform-api/user/listing-users/get-a-user#1-get-a-user | |
return {agentData, ticketCreatorData, sendbirdUser} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment