Getting Suggested Replies with ChatGPT

Nathan Begbie Updated by Nathan Begbie

With advances in generative AI and text-based responses to messages, we know that customers will also want to be able to leverage the power of tools like ChatGPT within their product. The good news is that Turn already has tools that allow you to connect ChatGPT to your helpdesk.

You can leverage Custom Integrations to create a connection to OpenAI's REST API, in order to generate responses. We have also created a sample repo on Github that you can use.

The steps are as follows:

  1. Generate a REST API key from OpenAI. This can be done here.
  2. Ensure that you have sufficient credit to support use of the API. Please note that this is billed differently to the ChatGPT interface for individuals.
  3. Create a custom integration endpoint. You will need to self host our example server as a starting point, we do not host this application for you, so it is important that you ensure that it is secure. Check the Read Me file which documents the environment variables that need to be set in order for the application to function. Importantly you will need to provide your API key and a custom prompt, although we provide a generic health focussed bot as a starting point.
  4. Connect Turn to this integration endpoint under Settings > Integrations. The process is documented in full in the Custom Integrations article.
  5. You should start seeing suggested replies in the UI.

Please note that this integration is an example and a starting point - it is not production ready, in that it will not limit the calls to OpenAI and unless further caching is implemented, you may find that you begin to use your credit quite quickly, as custom integrations are greedy (they will make a call to your endpoint every time a chat is loaded and thus may send the same data to ChatGPT).

Please also note that while things like phone numbers are stripped out of this code, you will be sending message data to an external service. Please consider the implications of this for user data.

Was this article helpful?

Getting data from the Contacts API endpoint

Upload media to Turn in order to use in code-based journeys

Contact