Reten Docs
Activities Guide

Submitting Results

How to submit activity results to Reten via the API.

After an activity is executed (task completed, message delivered), submit a result to Reten to track the outcome. Results drive the activity lifecycle — submitting a result automatically transitions the parent activity's status.

Creating a Task Result

Use POST /api/activity-results/tasks to submit a result.

Result Statuses

StatusDescriptionActivity Transition
PENDINGReceived but not fully processedNo change
COMPLETEDTask fully executedActivity → COMPLETED
NOT_EXECUTEDTask was not executedActivity → FAILED
CANCELEDTask was canceledActivity → CANCELED
TRANSFERREDTransferred to another operatorActivity → COMPLETED

All non-PENDING statuses are terminal — no further transitions are allowed.

Result Sources

Results can be linked to activities in two ways:

  • RETEN_ACTIVITY — Linked via activity_id (UUID) or provider_activity_id (external ID). The parent activity's status is automatically synced.
  • STANDALONE — No matching activity found. A standalone result is created with a commerce reference.

Request Body

FieldTypeRequiredDescription
activity_idUUIDNoReten activity ID
provider_activity_idstringNoExternal provider activity ID
commerce_external_idstringYesExternal ID of the commerce
occurred_atISO 8601YesWhen the result occurred
statusstringYesResult status (see table above)
external_statusstringNoProvider-specific status string
hard_overridebooleanNoSkip state transition validation
raw_payloadobjectNoRaw provider payload (stored as-is)
task_resultobjectYesTask-specific result details (see below)

task_result Object

FieldTypeRequiredDescription
resultstringYesTask result type code (e.g., success, not_home)
commentstringNoFree text comment
contact_typestringNoINBOUND or OUTBOUND
operator_external_idstringNoExternal operator ID
future_scheduled_atISO 8601NoSuggested date for a follow-up activity
payloadobjectNoAdditional task-specific data
curl -X POST https://api.reten.ai/api/activity-results/tasks \
  -H "Authorization: Bearer <token>" \
  -H "x-tenant-id: <tenant-id>" \
  -H "Content-Type: application/json" \
  -d '{
    "provider_activity_id": "ext-123",
    "commerce_external_id": "store-001",
    "status": "COMPLETED",
    "occurred_at": "2025-01-16T14:30:00.000Z",
    "task_result": {
      "result": "success",
      "comment": "Order placed successfully",
      "contact_type": "OUTBOUND"
    }
  }'
import axios from 'axios';

const response = await axios.post(
  'https://api.reten.ai/api/activity-results/tasks',
  {
    provider_activity_id: 'ext-123',
    commerce_external_id: 'store-001',
    status: 'COMPLETED',
    occurred_at: '2025-01-16T14:30:00.000Z',
    task_result: {
      result: 'success',
      comment: 'Order placed successfully',
      contact_type: 'OUTBOUND',
    },
  },
  {
    headers: {
      Authorization: 'Bearer <token>',
      'x-tenant-id': '<tenant-id>',
    },
  }
);

const result = response.data;

Response 201 Created

{
  "id": "770e8400-e29b-41d4-a716-446655440000",
  "activityId": "ee0e8400-e29b-41d4-a716-446655440000",
  "source": "RETEN_ACTIVITY",
  "resultStatus": "COMPLETED",
  "occurredAt": "2025-01-16T14:30:00.000Z",
  "taskDetails": {
    "result": "success",
    "comment": "Order placed successfully",
    "contactType": "OUTBOUND"
  },
  "createdAt": "2025-01-16T14:30:05.000Z",
  "updatedAt": "2025-01-16T14:30:05.000Z"
}

Task Result Types

Results reference a result type code via the task_result.result field from a global catalog of possible outcomes:

CodeLabel
successExito
not_homeNo se encontro
is_closedCerrado
no_interestSin interes
rescheduledReagendado
wrong_addressDireccion incorrecta
b2b_purchaseCompra B2B
no_answerSin respuesta
callback_requestedSolicita devolucion de llamada
otherOtro

Each tenant can configure which result types are active and classify them as positive or negative.

Update Guards

Results have two protection layers:

  1. Temporal guard — Rejects if occurred_at <= existingResult.updatedAt (always enforced)
  2. State transition guard — Validates status transitions via the status machine (skipped with hard_override: true)

Contact Direction

DirectionDescription
INBOUNDMerchant contacted operator/system
OUTBOUNDOperator/system contacted merchant

Required Permission

Creating results requires the CREATE_ACTIVITY permission, available to SUPER_ADMIN, ADMIN, and FDE roles.