Bahrul
BahrulPersonal Docs
KYZN

Analyze Conversation using AI

Using GET Method for API Conversation and Analyze using AI

Last updated: Jan 3, 2026

Analyze Conversation using AI

Use GET Method for API Conversation and Analyze using AI

Objective

Analyze customer conversations in real-time using AI to extract insights, classify interests, and offer tailored responses.

Implementation Steps

Trigger

You can replace this with another trigger (e.g., webhook, scheduled execution, manual trigger)

Set up a trigger to initiate the conversation analysis workflow when new messages arrive or at scheduled intervals.

PostgreSQL Data Source

You can replace with your data source (e.g., Firebase, MongoDB, REST API)

Query conversation data from PostgreSQL including contact information and conversation history.

Example PostgreSQL Output:

[
  {
    "uid": "ae20ec30-3106-4f3b-9947-fd70cd4c5ea8",
    "timestamp": "2024-11-12T00:00:00.000Z",
    "phone": "62800000000",
    "email": null,
    "name": "Eva",
    "gender": null,
    "date_of_birth": null,
    "age": null,
    "age_group": "",
    "branch": "KYZN",
    "language": null,
    "contact_owner": "Wahyu Hermawan",
    "source": "meta_ads",
    "sremarks": "120211373562470678",
    "content": null,
    "medium": "sleekflow",
    "mremarks": "wa",
    "assigned_pic": null,
    "interest": null,
    "leads_notes": null,
    "leads_qualification": "Inbound",
    "user_type": null,
    "kyzn_account": null,
    "sleekflow_id": "ae20ec30-3106-4f3b-9947-fd70cd4c5ea8",
    "leads_date": null,
    "mql_date": null,
    "mqlPlus_date": null,
    "tourPlus_date": null,
    "convert_date": null,
    "loss_date": null,
    "tour_date": null,
    "is_tour_show?": null,
    "trial_date": null,
    "is_trial_show?": null,
    "is_inbound?": true,
    "is_leads?": null,
    "is_mql?": null,
    "is_mqlPlus?": null,
    "is_tourPlus?": null,
    "is_trialPlus?": null,
    "is_convert?": null,
    "interest_remarks": null,
    "submitted_email": null,
    "assigned_email": null,
    "trialPlus_date": null,
    "membership_name": null,
    "package_name": null,
    "start_membership": null,
    "member_id": null,
    "total_amount": null,
    "payment_method": null,
    "promotion": null,
    "ref_program": null,
    "ref_id": null,
    "ref_name": null,
    "ref_phone": null,
    "identity_photo": null,
    "status": null,
    "convert_by": null,
    "end_membership": null,
    "signature": null,
    "contract": null,
    "offer_trial": null,
    "reply_after_offer": null,
    "last_appt_category": null,
    "conversationId": "504b8ae5-d230-4f68-9600-4240c83f9365",
    "assigned_date": "2024-11-12T03:14:32.000Z",
    "last_created_by": null,
    "is_renewal": null,
    "approach_by": "Annisa",
    "app_status": null,
    "start_approach": null,
    "expired_approach": null,
    "hide": null,
    "id": "50dfdf8e-81e5-11122024-0180-10278ee961d2",
    "convert_category": null,
    "renewal_category": null,
    "is_package": null,
    "q1_rate_class": null,
    "last_update": null,
    "pic_update": null
  }
]

HTTP Request (Sleekflow Get Conversation)

Fetch conversation messages using the SleekFlow API to retrieve the full conversation history.

In this tutorial, we use SleekFlow as the omnichannel platform. You can use your own platform instead.

See: SleekFlow API Documentation

ParameterValue
MethodGET
URLhttps://api.sleekflow.io/api/conversation/message/{{ $json.conversationId }}?limit=10
HeaderX-Sleekflow-Api-Key: [YOUR API KEY]

Example cURL:

curl --request GET \
  --url https://api.sleekflow.io/api/conversation/message/{conversationId} \
  --header 'Accept: application/json' \
  --header 'X-Sleekflow-Api-Key: 123'

Code Node (Combining Conversation)

Parse and combine the conversation data with contact information to create a unified context for AI analysis.

AI Agent (Conversational Analysis)

Use an AI agent to analyze the combined conversation data and extract:

  • Customer interests
  • Intent classification
  • Response recommendations
  • Trial/offer suitability

Code Node (Parse Results)

Extract and format the AI agent's output for downstream processing.

Example JavaScript Code:

// Code Node: Parse AI Agent's JSON Output and Extract Values
return items.map(item => {
  const jsonString = item.json.output; // Use 'output' as the field name

  let parsedData;
  try {
    // Parse the JSON string from the AI agent's output
    parsedData = JSON.parse(jsonString);
  } catch (error) {
    throw new Error('Failed to parse JSON: ' + error.message);
  }

  // Return the extracted values in the desired format
  return {
    json: {
      interest: parsedData.interest || '',
      interest_remarks: parsedData.interest_remarks || '',
      offer_trial: parsedData.offer_trial || false,
      reply_after_offer: parsedData.reply_after_offer || false
    }
  };
});

Example Output:

[
  {
    "interest": "Junior Anytime Class",
    "interest_remarks": "Paket untuk anak 5 tahun.",
    "offer_trial": true,
    "reply_after_offer": false
  },
  {
    "interest": "Adult Regular Class",
    "interest_remarks": "Sunset Yoga 3.0 event invitation.",
    "offer_trial": true,
    "reply_after_offer": false
  },
  {
    "interest": "Other Inquiry",
    "interest_remarks": "No valid messages to analyze.",
    "offer_trial": false,
    "reply_after_offer": false
  }
]

On this page