Skip to Main Content
Status Backlog
Created by Guest
Created on Dec 17, 2025

Clear drafts when new email is sent

Problem
When automations draft emails, threads can become cluttered with unsent drafts that the team then has to manually delete.

Request
Add a rule that automatically clears unsent drafts on a thread when a new outbound message is sent.

  • ADMIN RESPONSE
    Mar 30, 2026

    Your idea is now live and open for voting.

  • Attach files
  • Guest
    Mar 2, 2026

    I had a rule trigger a webhook in Zapier and wrote this script if anyone needs to do this


    const API_TOKEN = inputData.Front_API_token; 

    const conversationId = inputData.conversation_id;

    async function deleteAllDrafts() {
    const headers = {
    'Authorization': `Bearer ${API_TOKEN}`,
    'Content-Type': 'application/json'
    };

    // Step 1: Get all drafts for this conversation
    const draftsResponse = await fetch(
    `https://api2.frontapp.com/conversations/${conversationId}/drafts`,
    { headers }
    );

    const draftsData = await draftsResponse.json();
    const drafts = draftsData._results || [];

    if (drafts.length === 0) {
    return { message: 'No drafts found', deleted: 0 };
    }

    // Step 2: For each draft, get the version, then delete
    const deleted = [];
    for (const draft of drafts) {
    // First, fetch the full message to get the version
    const messageResponse = await fetch(
    `https://api2.frontapp.com/messages/${draft.id}`,
    { headers }
    );
    const messageData = await messageResponse.json();
    const version = messageData.version;

    // Now delete with the version
    const deleteResponse = await fetch(
    `https://api2.frontapp.com/drafts/${draft.id}`,
    {
    method: 'DELETE',
    headers,
    body: JSON.stringify({ version: version })
    }
    );

    const deleteResult = await deleteResponse.text();
    deleted.push({
    id: draft.id,
    version: version,
    status: deleteResponse.status,
    result: deleteResult
    });
    }

    return {
    message: `Processed ${deleted.length} draft(s)`,
    deleted: deleted.length,
    details: deleted
    };
    }

    return await deleteAllDrafts();