Skip to main content

Create Reminder Automation Processor

Overview

The Create Reminder automation creates CRM reminders/tasks for deals when they enter a specific pipeline stage. Supports various reminder types, priority levels, due dates, and assignments.

Source File: queue-manager/queues/deals/automations/reminder.js
Triggered By: queue-manager/services/deals/automations.js
Business Impact: HIGH - Task management

Processing Logic

sequenceDiagram
participant AUTO as Automation Service
participant QUEUE as Reminder Queue
participant DEAL as Deals
participant REMINDER as Reminders
participant ACTIVITY as Activity Log

AUTO->>QUEUE: Add automation job
QUEUE->>DEAL: Find eligible deals

loop For Each Deal
QUEUE->>REMINDER: Create reminder
REMINDER-->>QUEUE: Reminder ID
QUEUE->>ACTIVITY: Log reminder activity
QUEUE->>DEAL: Mark automation triggered
end

Key Features

Reminder Types

  • call - Phone call reminder
  • email - Email reminder
  • to-do - General task
  • sales_navigator_in_mail - LinkedIn InMail
  • sales_navigator_in_connection_request - LinkedIn connection

Configurable Fields

{
content: "Reminder content/description",
headline: "Reminder title",
pinned: true/false,
due_days: 7, // Days from now
reminder_type: "call",
priority: "high",
assigned: userID, // User to assign to
reminder_status: true/false // Completed status
}

Due Date Calculation

const dueDays = automation.data.due_days || 0;
const dueDateTime = moment().add(dueDays, 'days').toDate();

Validation

// Reminder type validation
if (
![
'call',
'email',
'to-do',
'sales_navigator_in_mail',
'sales_navigator_in_connection_request',
].includes(reminderType)
) {
throw new Error('Invalid reminder type provided.');
}

// Assigned user validation
if (assigned && !mongoose.Types.ObjectId.isValid(assigned)) {
throw new Error('Invalid assigned id provided');
}

Reminder Creation

let obj = {
account: accountID,
created_by: userID,
content,
headline,
deal: dealID,
type: 'deal',
due_date: dueDateTime,
type_of_reminder: reminderType,
pinned,
};

if (priority) obj.priority = priority;
if (assigned) obj.assigned = assigned;
if (reminderStatus) obj.status = 'done';

const reminder = await new CRMReminder(obj).save();

Collections Used

Input: deal-automation
Query: deal
Create: reminder
Create: activity

Use Cases

Example 1: Follow-Up Call

// Automation
{
stage_id: "demo_scheduled",
action: "create_reminder",
data: {
headline: "Follow-up call",
content: "Call to confirm demo attendance",
reminder_type: "call",
due_days: 1,
priority: "high",
assigned: userID
},
delay: 0
}

Example 2: Weekly Check-In

// Automation
{
stage_id: "negotiation",
action: "create_reminder",
data: {
headline: "Weekly check-in",
content: "Check progress on contract negotiation",
reminder_type: "to-do",
due_days: 7,
pinned: true
},
delay: 0
}

Error Handling

Common Errors

  1. Invalid Reminder Type: Not in allowed list
  2. Invalid Assigned User: User doesn't exist
  3. Invalid Priority: Not 'high' (typo check)

Performance

Execution Time: 200-600ms per deal
Complexity: MEDIUM
Lines of Code: 212

💬

Documentation Assistant

Ask me anything about the docs

Hi! I'm your documentation assistant. Ask me anything about the docs!

I can help you with:
- Code examples
- Configuration details
- Troubleshooting
- Best practices

Try asking: How do I configure the API?
09:31 AM