Skip to main content

AI Actions API

List All Actions

tenant_id
string
required
The ID of the tenant
curl -X GET \
  'https://a.messageflow.ai/api/v1/ai_actions?tenant_id=123' \
  -H 'Authorization: Bearer YOUR_AUTH_TOKEN'
[
  {
    "id": 1,
    "name": "Example Action",
    "action_type": 1,
    "initial_announcement": "Starting action",
    "initial_response": "Action completed",
    "voice": "echo",
    "speak": "Speaking text",
    "forward_number": "+1234567890",
    "integration_id": 1
  }
]

Get Action Details

id
string
required
The ID of the action
tenant_id
string
required
The ID of the tenant
curl -X GET \
  'https://a.messageflow.ai/api/v1/ai_actions/1?tenant_id=123' \
  -H 'Authorization: Bearer YOUR_AUTH_TOKEN'
{
  "id": 1,
  "name": "Example Action",
  "action_type": 1,
  "initial_announcement": "Starting action",
  "initial_response": "Action completed",
  "voice": "echo",
  "speak": "Speaking text",
  "forward_number": "+1234567890",
  "integration_id": 1,
  "say_before": "Before action text",
  "result_prompt": "Result prompt text",
  "tenant_id": 123
}

Create New Action

tenant_id
string
required
The ID of the tenant
ai_action[name]
string
required
Name of the action
ai_action[action_type]
number
required
Type of action
ai_action[initial_announcement]
string
Initial announcement text
ai_action[initial_response]
string
Initial response text
ai_action[voice]
string
Voice to use
ai_action[speak]
string
Text to speak
ai_action[forward_number]
string
Number to forward to
ai_action[integration_id]
number
ID of the integration
curl -X POST \
  'https://a.messageflow.ai/api/v1/ai_actions?tenant_id=123' \
  -H 'Authorization: Bearer YOUR_AUTH_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "ai_action": {
      "name": "New Action",
      "action_type": 1,
      "initial_announcement": "Starting new action",
      "initial_response": "New action completed",
      "voice": "echo",
      "speak": "New speaking text",
      "forward_number": "+1234567890",
      "integration_id": 1
    }
  }'
{
  "id": 2,
  "name": "New Action",
  "action_type": 1,
  "initial_announcement": "Starting new action",
  "initial_response": "New action completed",
  "voice": "echo",
  "speak": "New speaking text",
  "forward_number": "+1234567890",
  "integration_id": 1,
  "tenant_id": 123
}

Update Action

id
string
required
The ID of the action
tenant_id
string
required
The ID of the tenant
curl -X PUT \
  'https://a.messageflow.ai/api/v1/ai_actions/1?tenant_id=123' \
  -H 'Authorization: Bearer YOUR_AUTH_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "ai_action": {
      "name": "Updated Action",
      "action_type": 1,
      "initial_announcement": "Updated announcement",
      "initial_response": "Updated response",
      "voice": "echo",
      "speak": "Updated speaking text",
      "forward_number": "+1234567890",
      "integration_id": 1
    }
  }'
{
  "id": 1,
  "name": "Updated Action",
  "action_type": 1,
  "initial_announcement": "Updated announcement",
  "initial_response": "Updated response",
  "voice": "echo",
  "speak": "Updated speaking text",
  "forward_number": "+1234567890",
  "integration_id": 1,
  "tenant_id": 123
}

Delete Action

id
string
required
The ID of the action
tenant_id
string
required
The ID of the tenant
curl -X DELETE \
  'https://a.messageflow.ai/api/v1/ai_actions/1?tenant_id=123' \
  -H 'Authorization: Bearer YOUR_AUTH_TOKEN'
{
  "status": "Action 1 deleted"
}

HTTP Status Codes

  • 200: Success
  • 201: Created
  • 400: Bad Request
  • 401: Unauthorized
  • 404: Not Found
  • 422: Unprocessable Entity

Action Configuration

The action configuration includes:
  • Name and action type
  • Initial announcement and response
  • Voice settings
  • Speaking text
  • Forward number
  • Integration settings
  • Say before text
  • Result prompt

Action Types

  • 1: Standard Action
  • 2: Forward Action
  • 3: Integration Action
  • 4: Custom Action