# SMS API

import { Badge } from '@astrojs/starlight/components';

<Aside type="caution" title="/createSMSMessage는 더 이상 사용되지 않습니다">
새로운 통합은 [Messaging API v2](/ko/developer/api-reference/messaging-api-v2/)를 사용해야 합니다 — `Notify`에 `platforms: ["SMS"]`를 전달하세요. [마이그레이션 가이드](/ko/developer/api-reference/messaging-api-v2/migration-from-v1/#from-createsmsmessage)를 참조하세요.
</Aside>

<Aside type="note">
SMS 메시지를 보내기 전에 Control Panel에서 SMS 제공업체를 연결하세요. [자세히 알아보기](/ko/developer/first-steps/connect-messaging-services/sms-configuration/)
</Aside>

## createSMSMessage <Badge text="더 이상 사용되지 않음" variant="caution" size="small" />

사용자에게 SMS 알림을 보내는 데 사용됩니다

POST `https://api.pushwoosh.com/json/1.3/createSMSMessage`

### 요청 본문

| 이름 | 필수 | 유형 | 설명 |
|---|---|---|---|
| **auth*** | 예 | string | Pushwoosh Control Panel의 [API access token](/ko/developer/api-reference/api-identifiers/#api-access-token)입니다. |
| **application*** | 예 | string | [Pushwoosh application code](/ko/developer/api-reference/api-identifiers/#application-code) |
| **notifications*** | 예 | array | 콘텐츠 설정입니다. 메시지 매개변수의 JSON 배열입니다. 자세한 내용은 아래를 참조하세요. |

**알림 매개변수**

| 이름 | 필수 | 유형 | 설명 |
|---|---|---|---|
| **send_date*** | 예 | string | 알림을 보낼 날짜와 시간입니다. 즉시 보내려면 `YYYY-MM-DD HH:mm` 형식 또는 `now`를 사용하세요. |
| **content*** | 예 | string | SMS 메시지의 텍스트 내용입니다. |
| **devices*** | 예 | array | 고객 전화번호입니다(`/registerDevice`를 사용하여 UserId와 연결되어야 하며 `hwid` 매개변수에 지정되거나 `use_auto_registration`을 사용해야 합니다). 여기에는 하나의 번호만 지정할 수 있습니다. |
| **use_auto_registration** | 아니요 | boolean | `true`로 설정하면 `devices` 매개변수에 지정된 전화번호가 자동으로 등록됩니다. |
| **dynamic_content_placeholders** | 아니요 | object | 메시지 내용을 사용자 정의하기 위한 동적 콘텐츠 플레이스홀더입니다. 각 플레이스홀더는 해당 동적 값으로 대체됩니다. |
| **preset** | 아니요 | string | Control Panel의 SMS [Preset Code](/ko/developer/api-reference/api-identifiers/#preset-code)입니다. |

### 요청 예시

```json
{
  "request": {
    "application": "12345-67891",    // 필수. Pushwoosh application code.
    "auth": "yxoPUlwqm…………pIyEX4H",  // 필수. Pushwoosh Control Panel의 API access token.
    "notifications": [{
      "send_date": "now",            // 필수. YYYY-MM-DD HH:mm 또는 "now".
      "content": "Hello!",           // 필수. SMS 텍스트 (문자열).
      "devices": ["+1234567890"],    // 필수. 고객 전화번호 (`/registerDevice`를 사용하여 UserId와
                                     //           연결되어야 하며 "hwid" 매개변수에 지정되거나
                                     //           "use_auto_registration"을 사용해야 합니다).
                                     //           여기에는 하나의 번호만 지정할 수 있습니다.
      "preset": "XXXXX-XXXXX",       // 선택 사항. Control Panel의 SMS Preset Code.
      "use_auto_registration": true  // 선택 사항. "devices" 매개변수에 지정된 전화번호를
                                     //           자동으로 등록합니다.
    }]
  }
}
```

### 응답 예시

```json
{
  "status_code": 200,
  "status_message": "OK",
  "response": {
    "Messages": [
      "9648-0B10ECB6-0D9F214D"
    ]
  }
}
```

### 오류 응답
```json
{
  "status_code": 210,
  "status_message": "Invalid devices list. \"devices\" must be an array.",
  "response": {
    "Messages": []
  }
}
```

<Aside type="note">
 현재 각 SMS는 고객별로 별도의 요청으로 보내야 합니다.
</Aside>

SMS 통계를 얻으려면 [totalsByIntervals](/ko/developer/api-reference/statistics-api/message-statistics-api/#totalsbyintervals) 메서드를 사용하세요.

[Message History](/ko/product/statistics-and-analytics/message-history/) 섹션에서 각 메시지에 대한 통계를 볼 수도 있습니다.

<Aside type="caution">
일부 이동통신사는 전송 상태 데이터를 전송하지 않으므로 통계가 정확하지 않을 수 있습니다. 고객에게 번호를 제공하는 이동통신사에 자세한 내용을 확인할 수 있습니다.
</Aside>