Create Agent

Create a new agent in your workspace.

POST https://api.platica.mx/v1/agents

Request body

{
  "name": "Mi Asistente",
  "channel": "whatsapp",
  "systemPrompt": "Eres un asistente especializado en atención al cliente...",
  "channelId": ["channel-123"],
  "phoneNumber": ["+1234567890"],
  "imageUrl": "/images/mi-asistente.png",
  "status": "active",
  "owners": ["soporte@miempresa.com"],
  "supportInformation": {
    "supportPhone": "+1234567890",
    "supportEmail": "soporte@miempresa.com",
    "supportAddress": "Calle Principal #123",
    "outOfServiceBehavior": "limited",
    "serviceHours": {
      "monday": {
        "availability": "Abierto",
        "start": "9:00am",
        "end": "5:00pm"
      },
      "tuesday": {
        "availability": "Abierto",
        "start": "9:00am",
        "end": "5:00pm"
      },
      "saturday": {
        "availability": "Cerrado",
        "start": "Cerrado",
        "end": "Cerrado"
      },
      "sunday": {
        "availability": "Cerrado",
        "start": "Cerrado",
        "end": "Cerrado"
      }
    }
  },
  "assistanceTriggers": "",
  "assistanceEnabled": true,
  "recallLastConversation": false,
  "enableFileAttachments": true,
  "workingMessage": {
    "enabled": true,
    "trigger": {
      "type": "toolCallCount",
      "minToolCalls": 2
    },
    "message": {
      "enabled": true,
      "mode": "fixed",
      "fixedText": "Dame un momento, estoy procesando tu solicitud…"
    },
    "sticker": {
      "enabled": false
    }
  }
}

Body parameters

ParameterTypeDescriptionRequiredDefault
namestringAgent name (1-100 characters)
channelstringAgent platform"whatsapp"
systemPromptstringSystem prompt. If not empty, the version history is initialized and activePromptId is set.""
channelIdstring | arrayCommunication channel ID(s). May be a single internal ID or an array of IDs.null
phoneNumberstring | arrayPhone number(s) in international format, or an array of numbers.null
imageUrlstringAgent image URL"/images/campaignCreator.png"
statusstringAgent state"inactive"
supportInformationobjectSupport information and hours. Details below.Default configuration (see below)
assistanceTriggersstringHuman-assist triggers""
waitMessagestringWait message""
assistanceEnabledbooleanWhether human assistance is enabledtrue
recallLastConversationbooleanMemory across conversations: injects the summary of the last conversation into the promptfalse
enableFileAttachmentsbooleanFile reading: the agent accepts and processes attachments (images, audios, documents)
disableContextSummarizationbooleanKeep full history: skips automatic context compaction
workingMessageobject"Working" message sent to the customer when the agent is busy calling tools. See the full shape below.
ownersarrayList of responsible-user emails[]
{
  "supportAddress": "",
  "supportEmail": null,
  "supportPhone": null,
  "outOfServiceBehavior": "limited",
  "serviceHours": {
    "monday": { "availability": "Abierto", "start": "9:00am", "end": "5:00pm" },
    "tuesday": { "availability": "Abierto", "start": "9:00am", "end": "5:00pm" },
    "wednesday": { "availability": "Abierto", "start": "9:00am", "end": "5:00pm" },
    "thursday": { "availability": "Abierto", "start": "9:00am", "end": "5:00pm" },
    "friday": { "availability": "Abierto", "start": "9:00am", "end": "5:00pm" },
    "saturday": { "availability": "Cerrado", "start": "Cerrado", "end": "Cerrado" },
    "sunday": { "availability": "Cerrado", "start": "Cerrado", "end": "Cerrado" }
  }
}
ValueDescription
whatsappWhatsApp Business channel
telegramTelegram channel
instagramInstagram Direct channel
facebookFacebook Messenger channel
smsSMS messaging channel

Configuration of the wait message sent to the customer when the agent is processing a tool sequence that may take a while.

{
  "enabled": true,
  "trigger": {
    "type": "toolCallCount",
    "minToolCalls": 2
  },
  "message": {
    "enabled": true,
    "mode": "fixed",
    "fixedText": "Dame un momento, estoy procesando tu solicitud…"
  },
  "sticker": {
    "enabled": false
  }
}

enabled (boolean)

Turns the wait-message delivery on or off.

trigger (object) — when it fires

FieldTypeDescription
type"toolCallCount" \| "toolName" \| "any"Trigger mode. See table below.
minToolCallsinteger (1-10)Only applies when type is "toolCallCount" or "any". How many tools the agent must have called before sending the message.
toolNamesstring[]Only applies when type is "toolName" or "any". Tool names that trigger the message as soon as they are invoked.
match"exact" \| "prefix"How to compare against toolNames. Default "exact". With "prefix", e.g. "api_" activates for api_get_orders, api_search, etc.
typeMeaning
toolCallCountFires after N tool calls (uses minToolCalls).
toolNameFires when the agent calls a tool whose name is in toolNames.
anyFires on either of the two conditions above.

message (object) — what is sent

FieldTypeDescription
enabledbooleanWhether to send a text message (you can disable it and send only a sticker).
mode"fixed" \| "ai""fixed" sends literal text; "ai" generates it with AI based on a prompt.
fixedTextstringLiteral text to send (when mode is "fixed").
aiPromptstringInstruction for the AI that generates the message (when mode is "ai").

sticker (object) — optional sticker

FieldTypeDescription
enabledbooleanWhether a sticker is sent alongside the message.
urlstringSticker URL (when enabled is true).

Response

{
  "status": "success",
  "message": "Agent created successfully",
  "data": {
    "id": "agent_abc123"
  }
}

Notes

  • channelId and phoneNumber can be sent as a string or an array
  • in the agent response they are always returned inside comunicationChannel as arrays
  • owners must be sent as valid emails of users belonging to the workspace