Send a message
To send text and media messages to any particular user or group you can use the below API.
info
{api-base-url} can be obtained from the MirrorFly console.
HTTP request#
Request Params#
| Param | DataType | Required | Description | 
|---|---|---|---|
| chatType | String | Yes | Chat type. Possible values singlechat, groupchat | 
| toUser | String | Yes | User/Group to send message | 
| messageType | String | Yes | Type of message to be sent. Possible values are text,audio,video,image,file,location,contact | 
| message | String | No | Message to be sent. Applicable only if messageType=text. If want to mention any user then use @usernamesyntax | 
| replyTo | String | No | Message Id to which you want to reply | 
| file | File | Yes | File (Image, Video, Audio, Docs). Applicable only if messageType != text | 
| fileEncryption | Boolean | No | Encryption option of the uploaded file. Applicable only if messageType != text, default value is false. If the fileEncryption value istruefile would be uploaded as encrypted format. | 
| caption | Number | No | Caption of the uploaded file. Applicable only if messageType != text. If want to mention any user then use @usernamesyntax | 
| contactName | String | No | Name of the contact to be sent. Applicable only if messageType=contact | 
| contactPhone | String | No | Phone number of the contact to be sent. Applicable only if messageType=contact | 
| contactKey | String | No | Key to encrypt the contact to be sent. Applicable only if messageType=contact | 
| latitude | String | No | location latitude. Applicable only if messageType=location | 
| longitude | String | No | location longitude. Applicable only if messageType=location | 
| locationKey | String | No | Key to encrypt the location to be sent. Applicable only if messageType=location | 
| topicId | String | No | TopicId for the topic | 
| messageId | String | No | The message ID of the message to be edited. It can be used to edit a message within 15 minutes of the send time | 
Responses#
If successful, this action returns below response, in the response body.
Error#
In the case of an error, an error object like below is returned.
When the token passed in Headers is expired
In the case of a Bad Request, an error message is returned