# Send Kakao Message

{% hint style="info" %}
The HTTP API can only be used in a server environment.
{% endhint %}

You can use the HTTP API to send API-triggered Kakao Message campaigns.

Authentication is performed using the SDK Key.

* Add the SDK Key to the HTTP header as shown below.
* You can find the SDK Key in the Hackle Dashboard under [SDK Integration Info](https://dashboard.hackle.io/config/sdk-setting).

```http
X-HACKLE-API-KEY: {YOUR_SERVER_SDK_KEY}
```

### Request

{% hint style="warning" %}

* The target users must meet the "Send Target" conditions configured in the Kakao Message campaign.\
  Kakao Messages will not be sent to users who do not meet those conditions.
* Phone number collection per userId is required to send Kakao Messages.\
  Refer to the [guide document](/en/crm-marketing/crm-properties/collect-phone-number.md).
  {% endhint %}

```http
POST https://api.hackle.io/v1/kakao-message/trigger/send
```

#### Request Body

| Field       | Type                 | Required | Description                          | Restrict                       |
| ----------- | -------------------- | -------- | ------------------------------------ | ------------------------------ |
| campaignKey | number               | O        | Campaign Key for the Kakao Message   |                                |
| users       | array`<User object>` | O        | List of users to receive the message | **Maximum list length is 50.** |

**User Object**

| Field         | Type   | Required | Description                                                                                                                                                                  |
| ------------- | ------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| userId        | string | O        | User ID                                                                                                                                                                      |
| apiProperties | object | X        | Key-value pairs used for [Kakao Message personalization](https://docs.hackle.io/en/development-guide/http-api/pages/Z8UZ9l6RA0WLjIEyrBBh#개인화-메시지). key(string)-value(string) |

#### Example

```shell
curl -i -X POST \
  'https://api.hackle.io/v1/kakao-message/trigger/send' \
  -H 'X-HACKLE-API-KEY: YOUR_API_KEY_HERE' \
  -H 'Content-Type: application/json' \
  -d '{
    "campaignKey": 1,
    "users": [
      {
        "userId": "eb24b2d8-21a3-4e95-b801-626ba0904e01",
        "apiProperties": {
          "productNumber": "123"
        }
      }
    ]
  }'
```

### Response

The API returns a Success Response or Error Response object as the result of the send request.

#### Success (200)

{% hint style="info" %}
**A successful response to the Kakao Message send request does not guarantee that the user actually received the Kakao Message.**

Statistics on final delivery success can be checked in the Dashboard.
{% endhint %}

| Field      | Data Type | Description                                                    |
| ---------- | --------- | -------------------------------------------------------------- |
| dispatchId | string    | Unique UUID for the Kakao Message request triggered by the API |
| message    | string    | Contains the value "success".                                  |

**example**

```json
{
    "dispatchId": "bac3da45-f6e3-44ea-989e-e0fa0ffc9f5c",
    "message": "success"
}
```

#### Error

| Field   | Data Type | Description                    |
| ------- | --------- | ------------------------------ |
| code    | string    | A specific response error code |
| message | string    | A message describing the error |

**example**

```json
{
    "code": "INVALID_API_KEY",
    "message": "Invalid API key"
}
```

**error case**

| Http Status | Code                      | Message                                                    | Description                                                                  |
| ----------- | ------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------------------------- |
| 401         | INVALID\_API\_KEY         | "Invalid API key"                                          | When an invalid API KEY is included in the header                            |
| 401         | API\_KEY\_NOT\_FOUND      | "API key not found"                                        | When no API KEY is included in the header                                    |
| 400         | EXCEED\_USER\_MAX\_LENGTH | "Max input length exceeded"                                | When the maximum number of target users that can be sent at once is exceeded |
| 400         | CAMPAIGN\_NOT\_FOUND      | "Could not find kakao message campaign with the given key" | When no API-triggered campaign exists matching the given campaign key        |
| 400         | EMPTY\_IDENTIFIER         | "At least one identifier should be given"                  | When the userId is missing from the target user info for the Kakao send      |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hackle.io/en/development-guide/http-api/api-kakao-message-send.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
