Skip to content

REST API connector: support multi-step upload workflow (MAX needs /uploads + multipart + /messages for audio/video/files) #2355

@mysubcult

Description

@mysubcult

Hi Remi,

Summary

Please add multi-step request workflows to the REST API connector. This is required to send audio/video/files as real attachments in MAX messenger.

Right now LHC can only do one HTTP request per outgoing message/file. Because of that, in MAX I can only send audio/video/file as links, not as attachments.

Why (MAX API requires 2–3 steps)

MAX works like this:

  1. Get upload URL
    POST https://platform-api.max.ru/uploads?type=video|audio|file|image

  2. Upload file bytes (multipart/form-data)
    POST %UPLOAD_URL% with multipart field data=@file

  3. Send message referencing uploaded file
    POST https://platform-api.max.ru/messages with attachments
    For video/audio MAX returns a token from step 1/2 and it must be used in attachments.

Images are special: MAX also supports attaching an image by external url, so images can work in one step. But audio/video/files need the upload flow.

What we need in LHC

Add a “workflow / steps” mode for REST connectors:

  • Ability to run multiple HTTP requests in sequence

  • Ability to save values from JSON response into variables (e.g. {upload_url}, {token})

  • Ability to upload a file as multipart/form-data

    • either from LHC stored file path/id
    • or by downloading {file_url} server-side first
  • Ability to use captured variables in next steps

Minimal example (pseudo-config)

Send video as attachment to MAX:

Step 1 – create upload

  • POST /uploads?type=video

  • capture:

    • upload_url (string)
    • token (string)

Step 2 – upload bytes

  • POST {upload_url}

  • multipart/form-data

    • data: file bytes (from LHC file or downloaded from {file_url})

Step 3 – send message

  • POST /messages
  • body example:
{
  "text": "Here is video",
  "attachments": [
    { "type": "video", "payload": { "token": "{{token}}" } }
  ]
}

Image case (already works):

{
  "text": "photo",
  "attachments": [
    { "type": "image", "payload": { "url": "{{file_url}}" } }
  ]
}

Acceptance criteria

  1. REST connector supports 2+ sequential requests per outgoing message.
  2. Can store JSON response fields into variables for later steps.
  3. Supports multipart file upload (field name data) with real file bytes.
  4. With this, MAX audio/video/file are sent as attachments, not links.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions