> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cria.chat/llms.txt
> Use this file to discover all available pages before exploring further.

# Scheduled actions

> Configure actions that run after a delay from the contact's last message.

# Scheduled actions

Scheduled actions are `DELAYED_JOB` jobs that run after a delay from the contact's last incoming message. Execution depends on the current stage, active rules, and configured delay—not on an AI decision.

<Note>
  Scheduled actions do not inherit rules from the `main` set. Each stage must have its own rules or share a rule associated with multiple stages.
</Note>

A rule can use `execute_once` to run only once per contact.

## Scheduled HTTP Call

```json theme={null}
{
  "type": "HTTP_CALL",
  "delay_in_seconds": 3600,
  "url": "https://seu-endpoint/webhook",
  "auth": {
    "type": "bearer",
    "token": "SEU_TOKEN"
  },
  "method": "POST",
  "timeout": 10000,
  "run_ai_after": true,
  "error_message": "Fallback message.",
  "execute_once": false
}
```

`type`, `delay_in_seconds`, `url`, and `method` are required. `auth`, `timeout`, `run_ai_after`, `error_message`, and `execute_once` are optional.

### Outgoing request

The endpoint receives an envelope containing the function arguments, project, and contact:

```json theme={null}
{
  "params": {},
  "query": {},
  "body": {
    "function_args": {},
    "project": {
      "id": 36,
      "account_id": 5,
      "inbox_id": 156
    },
    "contact": {
      "conversation_id": 17765,
      "source_id": "487",
      "identifier": "+5511999999999",
      "name": "Example contact",
      "configurations_set": "compra",
      "custom_infos": {},
      "additional_data": {},
      "file_ids": [],
      "vector_store_id": null
    }
  }
}
```

### Response

The minimum response is:

```json theme={null}
{
  "output": "..."
}
```

`output` is required and must be a string. An empty response is treated as an error. The endpoint may also return `continue_conversation`, `message_to_ai`, and `direct_messages`, as described in [HTTP Call](/platform/gia/functions/http-call).

The AI is called again only when both conditions are true:

```text theme={null}
run_ai_after === true
continue_conversation !== false
```

## Force Message

Force Message actions resume a conversation without an HTTP integration.

### Message to the AI

`FORCE_NEW_MESSAGE_TO_AI` delivers the message as an instruction for the AI to write a response using the conversation history.

```json theme={null}
{
  "type": "FORCE_NEW_MESSAGE_TO_AI",
  "message": "Resume the conversation briefly.",
  "delay_in_seconds": 900,
  "execute_once": true
}
```

### Direct message to the contact

`FORCE_NEW_MESSAGE_TO_USER` sends the text directly without AI rewriting.

```json theme={null}
{
  "type": "FORCE_NEW_MESSAGE_TO_USER",
  "message": "Hello, can I help with anything else?",
  "delay_in_seconds": 900
}
```

The rule is scheduled only when it is active and associated with the contact's current stage.
