Skip to main content
Skip table of contents

Send a Media message

A Channel Connector can send a file message to Hybrid Chat.  There are two ways to upload a file:

  1. Specify the fileStream object to be uploaded
  2. Specify the fileURL 

To send a file using filesStream Object

  1. Call Upload a file API with the fileStream object. Upon success you'll get the filename from the server.
  2. Create a Download File Stream URL and specify the filename from step# 1 as a query param.
  3. Create a Media message and specify mediaUrl containing the URL created in step# 2.


Request Query Params

PropertyTypeDesc.

conversationId REQUIRED

StringUnique id of the file.  

file REQUIRED

FileStream Object 

The file stream object of the file that should be uploaded on Hybrid Chat. 

Response

StatusDescriptionResponse
SuccessCode 200 for success loading of file on server.

Message - String - Required - "File uploaded successfully."

etag - String - Required  - HTTP response header is an identifier for a specific version of a resource and used for tracking purposes.

name - String - Optional  - this is the unique file name.

type - String - Optional - type and extension of the file e.g. image/png

size - Numeric - Required - size of the uploaded file.

Internal Server ErrorCode 500 when a server error occurs.Message: "An error occurred while uploading file."
Bad RequestCode 404 when there is a problem uploading file.Message: "An error occurred while uploading file."


To send a file using File URL

  1. Call Upload a file from URL API and specify sourceUrl (the media URL to upload).
  2. Create a Download File Stream URL and specify the filename from step# 1 as a query param.
  3. Create a Media message and specify mediaUrl containing the URL created in step# 2.


Request parameters

PropertyDesc.
conversationId - String - OptionalID for tagging media.
sourceUrl - URL - Requiredget file from the given URL
channel - String - RequiredThe channel where conversation is in progress.
fileName - String - Optionalto be specified by user. Appended with conversationId in response. If no name is specified, file name is extracted from the URL.
oauth - Object - OptionalWhen OAuth is required to download the file from the specified URL mentioned in sourceURL property. 
APIKey360 - String - Required for 360 DialogFlow Connector

The connector API Key for authorization to 360 connector.

Required only for 360Dialog connector for WhatsApp 

mime_type - String - Optionaltype and extension of the file e.g. image/png


Response

StatusDescriptionResponse body
SuccessCode 200

Message - String - Required - "File uploaded successfully."

etag - String - Required  - HTTP response header is an identifier for a specific version of a resource and used for tracking purposes.

name - String - Optional  - name can be specified by the user. It is saved with conversation ID appended to it e.g. 11111_filename.ext

type - String - Optional - type and extension of the file e.g. image/png

size - Numeric - Required - size of the uploaded file.

Internal Server ErrorCode 500Message: "An error occurred while uploading file."
Bad RequestCode 404Message: "An error occurred while uploading file."

Assumptions and Constraints

  • Maximum file size is 5Mb. The size is configurable and can be changed based on the business need.
  • There is no restriction of file type/extension in HyrbidChat. It is also configurable based on the business requirements. 
  • Uploaded files can be stored indefinitely on server if required. Time limit for file storage on server is dependent upon the space requirements for the business deploying the HyrbidChat solution. 
  • For downloading media, only filename needs to be specified. Example is available on Expertflow Public Workspace.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.