Using Custom Agents for Timezone-Based Social Inbox Assignment

Using Custom Agents for Timezone-Based Social Inbox Assignment

Global teams often struggle with manual Social Inbox triage: delayed response times, inconsistent routing, missed inquiries, and a noisy inbox full of spam and low-priority comments. This use case walks you through configuring Custom Agent workflows that analyze inbound conversations, categorize them, and assign them to the right regional owner based on when the conversation was opened.

Related inbox triage workflows

Choose the guide that matches your goal: Language and intent routing for conversations, Keep or close conversations automatically, or Comment-specific triage.

Prerequisites

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

Before you begin, determine your routing requirements: which comments to route or close, which timezone windows apply, and which Oktopost admins should receive assignments in each window.

Example Use Cases

Scenario Outcome
Negative sentiment within the comment Assigned to social media admin
Comment opening up an intellectual debate Assigned to social media admin
Conversation started at 9am EST Assigned to US lead
Conversation started at 9am UTC Assigned to EMEA lead
Spam comment Auto-closed

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 comment on a post
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. Using a single agent is possible only if conversations are closed immediately after responding, because new replies reopen the conversation as a new event.

Configure the Workflow

The workflow performs the following sequence:

  1. Trigger a conversation event
  2. Analyze conversations for spam
  3. Filter out spam and move to other conversations
  4. Analyze remaining conversation content and label it
  5. Filter by timezone
  6. Assign conversations based on the chosen timezone windows

Step 1: Create the Trigger Events

  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 Initial AI Action Node to Detect Spam

If you plan to auto-close spam conversations, detect spam before the primary classification step so spam can be closed before the main assessment runs.

Add an AI Action node after the trigger and enable Read only permissions. Under Advanced Response Fields, create the following String fields:

Field Name Purpose
SPAMJUDGEMENT Single-word spam classification
REASON Single-sentence justification

Paste the following prompt into the AI Action node. Replace <INSERT_EVENT_ID_HERE> with the Event ID from the picker and <INSERT_COMPANY_NAME_HERE> with your company name.

### INPUT DATA
Field 1:
{{nodes.oktopost-events_<INSERT_EVENT_ID_HERE>.output.Item.Data.CommentContent.Text}}

Field 2:
{{nodes.oktopost-events_<INSERT_EVENT_ID_HERE>.output.Item.Data.Content.Text}}

Field 3:
{{nodes.oktopost-events_<INSERT_EVENT_ID_HERE>.output.Item.Data.LatestMessage.Text}}

Field 4:
{{nodes.oktopost-events_<INSERT_EVENT_ID_HERE>.output.Data.LatestMessage.Text}}

Field 5:
{{nodes.oktopost-events_<INSERT_EVENT_ID_HERE>.output.Data.CommentContent.Text}}

Field 6:
{{nodes.oktopost-events_<INSERT_EVENT_ID_HERE>.output.Data.Content.Text}}

### TASK 1: SPAMJUDGEMENT
Analyze the input to identify if the conversation can be considered SPAM

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

### TASK 2: SPAM Categorization
Categorize the input based on the following definitions:

SPAM: brief description of spam messages received
SPAM EXAMPLE 1: Messages that are clearly advertisement that have no mention of <INSERT_COMPANY_NAME_HERE>
SPAM EXAMPLE 2: Messages that are completely unrelated to <INSERT_COMPANY_NAME_HERE>
SPAM EXAMPLE 3: Messages that contain multiple URLs to different sites

### TASK 3: REASON
Analyze the evaluations made in TASK 2, and 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.

Step 3: Filter Out Spam Messages

Add a filter node to route spam away from the rest of the flow so you can auto-close it before the primary assessment.

Response Type Route Condition
response.SPAMJUDGEMENT TEXT EQUALS SPAM
Decision Next Action
YES Oktopost Action = update_conversation_status to close
NO AI Action to begin primary assessment

Step 4: Run the Primary Classification AI Action

Define the categories that match your inbox. Clear, distinct examples produce more accurate classifications.

Add an AI Action node on the No branch after the spam filter and enable Read only permissions. Under Advanced Response Fields, create the following String fields:

Field Name Purpose
CATEGORIZATION Single-word category label
REASON Single-sentence justification

Paste the following prompt into the AI Action node. Replace <INSERT_EVENT_ID_HERE>, <INSERT_COMPANY_NAME_HERE>, and <EXAMPLE CATEGORIES>. The example uses NEWJOINER, PROMOTIONS, NEGATIVE, NEWS, and MEDIA, but you should define your own categories and examples.

### INPUT DATA

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

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

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

- Only allowed categories are <EXAMPLE CATEGORIES>.

## DEFINITIONS

Apply NEWJOINER in the following cases:

- The text contains a brief description of the scenario around a new employee to the company within the message
- An employee posts that they are excited to join <INSERT_COMPANY_NAME_HERE>
- An employee mentions the company and says they have joined it as a new employee/starter

Apply PROMOTIONS in the following cases:

- The text contains a brief description of the content around employee promotions or certifications within the message
- Announcements about employees mentioning they have been promoted at <INSERT_COMPANY_NAME_HERE>
- Announcements about employees mentioning they have received a certification from <INSERT_COMPANY_NAME_HERE>

Apply NEGATIVE in the following cases:

- The text contains a brief description of messages that have negative sentiment or aggressive language:
- Message contains complaints about <INSERT_COMPANY_NAME_HERE>
- Message contains aggressive language
- Message contains negative sentiment about <INSERT_COMPANY_NAME_HERE>

Apply NEWS in the following cases:

- The text contains a brief description of content that is third-party news articles related about <INSERT_COMPANY_NAME_HERE> and contains an external URL
- Third-Party thought-leadership content about <INSERT_COMPANY_NAME_HERE>

Apply MEDIA in the following cases:

- The text has a brief description of the content that has come from particular journalists, media or analysts listed below:
- John Smith, Jane Smith, Mike Smith, Monica Smith

- 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., NEWJOINER).

### 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.
- For NEWJOINER scenarios, provide responsive text that is exactly "Welcome to <INSERT_COMPANY_NAME_HERE>, we're glad to have you here!"

Step 5: Add Timezone Filters

Create filter nodes after the classification AI Action node. Use one filter when all matching conversations follow the same assignment path, or chain multiple filters when you need different actions or additional timezone windows.

Response Pattern Route Condition
EventDate Time of day Is between [Start time] and [End time] with the timezone set to match your assignees

Route the Yes branch when the conversation should be assigned to a user during the timezone window listed in the condition. Route the No branch to a single fallback assignee or to another timezone filter.

Step 6: Configure Oktopost Actions to Assign Conversations

This guide focuses on timezone-based assignment, but you can adapt the Oktopost Action to close conversations, attach tags, or respond instead.

Add an Oktopost Action node on the Yes branch from the timezone filter. Set the action type to assign_conversation and configure the parameters:

Parameter Value
conversationId Event - ID (from the picker)
assignee_id Choose the admin from the list
Note (optional) response.CATEGORIZATION | response.REASON (from the picker)

Step 7: Add Additional Actions if Required

You can expand the workflow by adding:

  • More timezone variations, routing the No branch from one filter to another filter with different between times
  • Additional actions such as notes on closed messages
  • More classification parameters in the AI Action node
  • More filters when additional parameters require different actions

Recommended Testing Scenarios

Before deploying to production, test the workflow using sample comments if your internal permissions allow.

Test Message Expected Value Created Time Expected Action
I'd like to set up a demo BUSINESS MEETING 9:15am UTC Auto-assigned to EMEA lead
I'm not happy with… NEGATIVE 9:05pm UTC Auto-assigned to USA lead

Troubleshooting

The Timezone Filter Is Not Assigning to Users

Verify:

  • Your filter uses the exact filter node parameters listed above
  • Your times do not overlap if you use multiple timezone filters
  • You set the timezone to the window your assignees cover

AI Output Formatting Fails

Ensure the AI prompt strictly returns CATEGORIZATION and REASON as separate fields. Avoid modifying the output schema.

Only Initial Conversations Are Auto-Closed

Ensure you also have the second agent with Conversation Updated as the trigger, and that the remaining prompts, filters, and actions match the first workflow exactly.

Best Practices

  • Keep routing logic simple yet clear
  • Review AI classifications regularly
  • Use internal notes to improve transparency
  • Test with real-world social messages before scaling

Final Workflow Example

The completed workflow should contain at minimum:

  • One event trigger
  • One initial AI Action node for spam detection
  • One spam filter and one Oktopost Action
  • One primary categorization AI Action node
  • One timezone conditional filter
  • At least one Oktopost Action to assign conversations

You may need additional filters and Oktopost Actions depending on how many timezone windows and assignees you require.

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