Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Conversation and Tone Analyzer Integration Example

This example provides sample code for integrating Tone Analyzer and Conversation.

  • tone_detection.js - sample code to initialize a user object in the conversation payload's context (initUser), to call Tone Analyzer to retrieve tone for a user's input (invokeToneAsync), and to update tone in the user object in the conversation payload's context (updateUserTone).

  • tone_conversation_integration.v1.js - sample code to use tone_detection.js to get and add tone to the payload and send a request to the Conversation Service's message endpoint.

Requirements to run the sample code

Credentials & the Workspace ID can be set in environment properties, a .env file, or directly in the code.

Command to run the sample code

npm install # just once, to download dependencies node tone_conversation_integration.v1.js