# Messages API

# Send RCS messages

### Request
#### API Domain
* https://api.incsapp.com

#### API Route
* /external/messages/rcs

#### Method
* **POST**

#### Headers
* Content-Type: application/json
* certification-code: f484bd42-4a0c-39d....

#### Parameters
**The below two fields are common in all messages.**
|Parameter|Type| Mandatory | Description | Remarks
|-|-|-|-|-|
|to|string|Yes|Recipient phone number. Must be a digits-only format of country code + phone number. | e.g: 628XXXXXXXXX
|type|string|Yes|Message type. Supported values are template message (template), and regular messages (text, image, video, document) which can be sent within 24 hours after the user replies.|e.g: text|

#### Samples

##### Template message **without parameters**
```json
{
    "to": "85268411234",
    "type": "template",
    "template": {
        "name": "test_button_reply_1"
    }
}
```

##### Template message **with parameters**

```json
{
    "to": "85268411234",
    "type": "template",
    "template": {
        "name": "test_button_reply_1",
        "parameters": {
            "username": "jack",
            "service_name": "promotion"
        }
    }
}
```

##### Text message
```json
{
    "to": "85268411234",
    "type": "text",
    "text": "Hello"
}
```
##### Image message
```json
{
    "to": "85268411234",
    "type": "image",
    "image": {
        "link": "https://static.incsapp.com/chat/images/header-98403274893.png"
    }
}
```
##### Video message
```json
{
    "to": "85268411234",
    "type": "video",
    "video": {
        "link": "https://static.incsapp.com/chat/videos/abc.mp4"
    }
}
```

##### Document message

```json
{
    "to": "85268411234",
    "type": "document",
    "document": {
        "link": "https://static.incsapp.com/chat/files/template.pdf"
    }
}
```

### Response

#### Sample Successful Response
```json
{
    "status": "success",
    "code": 200,
    "message": "",
    "data": {
        "msg_id": "019b8d8e-c4e7-73fe-b333-470c51e61f9f"
    },
    "error": {}
}
```



#### Sample Error Response
```json
{
    "status": "error",
    "code": 10004,
    "message": "Template with the code [api_4_standalone_image] and bot [Wk3rZWBx435KKATY] received with insufficient custom params",
    "data": {},
    "error": {}
}
```