Using Custom Agents for Keyword-Based Social Inbox Assignment

Using Custom Agents for Keyword-Based Social Inbox Assignment

Manual social inbox triage creates operational challenges for global teams: delayed response times, inconsistent comment routing, missed customer inquiries, time wasted reviewing spam or low-priority conversations, difficulty filtering advertising or self-promotion comments, and a consistently full inbox with plenty of noise. This use case walks you through configuring Custom Agent workflows that detect particular keywords within a conversation and take action automatically, including assigning conversations, adding notes, applying tags, or closing conversations that do not require a response.

Related inbox triage workflows

Choose the guide that matches your goal:

Prerequisites

  • Access to Oktopost Custom Agents
  • Permission to create workflows
  • Permission to use AI Action nodes

Before you begin, determine the keywords you want the Custom Agent to assess in incoming conversations.

Example Use Cases

Scenario Outcome
Message with wording that is negative about a product Assigned to customer support team
Comment about wanting a job Assigned to recruitment team
Wording with irrelevant commentary Auto-closed
Message specifically requesting a demo Assigned to sales lead

Two-Agent Overview

Oktopost distinguishes between newly created conversations and updates to existing conversations. To ensure no messages bypass automation, create two nearly identical workflows.

Agent Trigger Purpose
Initial Triage Agent New Conversation Handles the first point of a conversation
Follow-up Triage Agent Conversation Updated Handles replies and ongoing thread activity

Without both workflows, some conversations may not be processed by the Custom Agent.

Configure the Workflow

The workflow performs the following sequence:

  1. Trigger a conversation event
  2. Analyze the text within the conversation to search for keyword(s)
  3. Filter the conversation based on whether keyword(s) exist
  4. Take action depending on the keyword(s), such as assigning or closing the conversation
Custom Agent workflow overview showing trigger, AI Action, filter, and Oktopost Action nodes

Step 1: Create the Trigger Event

  1. Create a new Custom Agent workflow for the Initial Triage Agent.
  2. Set the trigger to New Conversation.
  3. Create a second, nearly identical workflow for the Follow-up Triage Agent.
  4. Set the trigger on the second workflow to Conversation Updated.
  5. Configure the remaining steps identically on both workflows.

Step 2: Configure the AI Action Node

Add an AI Action node after the trigger. Open the AI Action node settings and enable Read permissions so the node can access conversation content from the trigger event.

Under Advanced Response Fields, create the following String fields:

Field Name Description
CATEGORIZATION Keyword match category returned by the AI Action
REASON Single-sentence justification for the categorization

Replace <YOUR_TRIGGER_NODE_ID> in the prompt below with the Trigger node ID from your workflow. Replace <COMPANY NAME> with your company name. Customize the category names and keyword list to match your routing requirements. The NONE category is required so conversations without matching keywords can be filtered separately.

AI prompt:

### INPUT DATA

Check these fields for content:
Field 1: {{nodes.oktopost-events_<YOUR_TRIGGER_NODE_ID>.output.Item.Data.CommentContent.Text}}
Field 2: {{nodes.oktopost-events_<YOUR_TRIGGER_NODE_ID>.output.Item.Data.Content.Text}}
Field 3: {{nodes.oktopost-events_<YOUR_TRIGGER_NODE_ID>.output.Item.Data.LatestMessage.Text}}
Field 4: {{nodes.oktopost-events_<YOUR_TRIGGER_NODE_ID>.output.Data.LatestMessage.Text}}
Field 5: {{nodes.oktopost-events_<YOUR_TRIGGER_NODE_ID>.output.Data.CommentContent.Text}}
Field 6: {{nodes.oktopost-events_<YOUR_TRIGGER_NODE_ID>.output.Data.Content.Text}}

Your task is to categorize new social media conversations coming from the social inbox based on the input data, and provide the reason for the categorization decision.

### CATEGORY
Categorize the inbox conversation based on the following definitions:

- The only allowed categories are KEYWORD and NONE.

Apply KEYWORD in the following situations:

- The conversation must contain at least one of the following keywords: HELP, PANIC, LOGIN, STUCK, BAD

Apply NONE in the following situations:

- The conversation does not contain at least one of the following keywords: HELP, PANIC, LOGIN, STUCK, BAD

- Ignore fields that are empty, "null", or contain only URLs.
- Priority: If multiple fields have text, use the most descriptive one.
- Label analysis Output: Exactly one word, ALL CAPS (e.g., KEYWORD).

### REASON
Based on the categorization, provide a single sentence justification according to these rules:

- The reason must be a single sentence written strictly in ENGLISH, even if the input text was in another language.
- Phrase it as supportive, collaborative guidance for the assigned team member, explaining why an action is recommended and how they might want to handle it (e.g., "you may want to follow up" or "you may want to react to this comment"), rather than a direct command.
- For customer inquiries and collaborations, explicitly state that a quick response is recommended to open up dialogue.

Step 3: Configure the Filter Node

  1. Add a filter node after the AI Action node.
  2. Use a single filter when all matching conversations follow the same action path.
  3. Add multiple filters when routing requires different action types (auto-close, assign to a user, keep open with a note) or when the same action type routes to different users based on conversation category.

Example filter condition (route matching conversations via the Yes branch):

Response Operator Value
response.CATEGORIZATION EQUALS KEYWORD

Step 4: Configure Oktopost Actions

Configure the Oktopost action at the end of each filter branch based on your routing decision.

Assign conversations to a user

Parameter Value
Oktopost Action assign_conversation
conversationId Event, ID (from the picker)
assignee_id Name of the user to assign to (from the picker)
note (optional) response.CATEGORIZATION and response.REASON (from the picker)

Automatically close conversations

Parameter Value
Oktopost Action update_conversation_status
conversationId Event, ID (from the picker)
status closed (from the picker)

Step 5: Add Additional Actions

You can expand the workflow by adding:

  • More actions, such as adding notes to closed messages
  • More defining parameters during the AI Action
  • More filters when additional AI response fields require different routing paths

Recommended Testing Scenarios

Before confirming final implementation, test the workflow using sample conversations if your permissions allow.

Test Message Keyword Found? Expected Action
I'm not happy with [COMPANY] YES Auto-assigned
I'd like to book a demo YES Auto-assigned
This is interesting, what about…. NO Auto-closed
This is great! NO Auto-closed

Troubleshooting

Conversations without keywords are being assigned (wrong action)

  • Verify the keywords in your AI prompt match the words you expect to detect
  • Confirm the prompt includes a NONE category for conversations that do not contain a keyword

The wrong action is occurring

  • Verify the filter conditions reference the correct response field and value
  • Confirm the Oktopost Action parameters match the action you intend for each filter branch

Final Workflow Example

The completed workflow should contain:

  • One event trigger
  • One AI Action node
  • One filter node
  • At least one Oktopost Action

The final structure should resemble the workflow diagram below, depending on how many filters and Oktopost Actions you require:

Completed Custom Agent workflow diagram with trigger, AI Action, filter, and Oktopost Action nodes

Keep routing logic simple and clear, review AI classifications regularly, use internal notes to improve transparency, and test with real-world social messages before scaling the workflow.

Was this article helpful?
0 out of 0 found this helpful