Create Message

POST /api/v1.0/messages

This endpoint creates a new message.

application/json

Body Required

  • type string Required

    Specifies the message type. Supported values include text, gif, and document.

  • text string Required

    The message content. Required only when the message type is set to text.

  • url string Required

    URL of the GIF. Required only when the message type is set to gif.

  • doc_attachment string Required

    Document attachment identifier. Required only when the message type is set to document.

  • entity_key string Required

    Unique identifier for the document thread. Required only when doc_id is provided.

  • chat_id string Required

    Unique identifier of the chat to which the message belongs. Required when no other reference (message_id, task_id, file_id, or doc_id) is provided.

  • message_id string Required

    Unique identifier of the parent message (used for replies). Required when no chat_id, task_id, file_id, or doc_id is provided.

  • task_id string Required

    Unique identifier of the task associated with this message. Required when no other entity (chat_id, message_id, file_id, or doc_id) is specified.

  • file_id string Required

    Unique identifier of the file associated with this message. Required when no other entity (chat_id, message_id, task_id, or doc_id) is specified.

  • doc_id string Required

    Unique identifier of the document associated with this message. Required when no other entity (chat_id, message_id, task_id, or file_id) is specified.

  • task object

    Details of the related task, if applicable. Optional field for embedding task data.

  • external_files array[string]

    List of external file attachments associated with this message.

  • nifty_files array[string]

    List of file identifiers from Nifty linked with this message.

  • date string(date-time)

    Timestamp representing the date and time of message creation.

  • bot_name string

    Name of the bot that created or sent the message, if applicable.

  • bot_avatar string

    Avatar URL of the bot that created or sent the message, if applicable.

  • hidden array[string]

    List of user IDs for whom the message should remain hidden.

  • emails string

    Comma-separated list of email addresses mentioned in the message, if any.

  • annotation_id string

    Identifier of the annotation linked with this message.

  • context_text string

    Contextual text related to the message (for example, quoted or referenced text).

  • audio_duration string

    Duration of the attached audio message, represented as a string (e.g., "00:30").

  • created_by_type string

    Specifies the type of the user who created the message (e.g., "user", "bot").

  • created_by string

    Unique identifier of the user who created the message.

Responses

  • 201 application/json

    The resource created successfully

    Hide response attributes Show response attributes object
    • message string Required
    • data object Required
  • 401

    The client request has not been completed because it lacks valid authentication credentials for the requested resource.

  • 403

    The client does not have access rights to the content.

  • 405

    The request method is known by the server but is not supported by the target resource.

POST /api/v1.0/messages
curl \
 --request POST 'https://openapi.niftypm.com/api/v1.0/messages' \
 --header "Content-Type: application/json" \
 --data '{"type":"string","text":"string","url":"string","doc_attachment":"string","entity_key":"string","chat_id":"string","message_id":"string","task_id":"string","file_id":"string","doc_id":"string","task":{},"external_files":["string"],"nifty_files":["string"],"date":"2025-05-04T09:42:00Z","bot_name":"string","bot_avatar":"string","hidden":["string"],"emails":"string","annotation_id":"string","context_text":"string","audio_duration":"string","created_by_type":"string","created_by":"string"}'
Request examples
{
  "type": "string",
  "text": "string",
  "url": "string",
  "doc_attachment": "string",
  "entity_key": "string",
  "chat_id": "string",
  "message_id": "string",
  "task_id": "string",
  "file_id": "string",
  "doc_id": "string",
  "task": {},
  "external_files": [
    "string"
  ],
  "nifty_files": [
    "string"
  ],
  "date": "2025-05-04T09:42:00Z",
  "bot_name": "string",
  "bot_avatar": "string",
  "hidden": [
    "string"
  ],
  "emails": "string",
  "annotation_id": "string",
  "context_text": "string",
  "audio_duration": "string",
  "created_by_type": "string",
  "created_by": "string"
}
Response examples (201)
{
  "message": "string",
  "data": {}
}