문자 본문에 긴 URL 을 그대로 넣으면 두 가지 손해를 봅니다. **바이트를 잡아먹고**, **누가 눌렀는지 알 수 없습니다.**

```text
[이벤트] 가을 특가! https://shop.example.com/promotions/autumn-2026?utm_source=sms&utm_campaign=autumn
→ 90바이트를 훌쩍 넘겨 LMS 로 승격되고, 반응은 측정되지 않는다.

[이벤트] 가을 특가! https://sendgo.io/s/k7Rm2xQ
→ SMS 안에 들어가고, 클릭이 집계된다.
```

## 짧은주소 만들기

`POST /api/v2/short-urls`

| 파라미터 | 필수 | 설명 |
| --- | --- | --- |
| `targetUrl` | ✅ | 원본 URL. `http`/`https` 만 허용, 최대 2,048자 |
| `title` | | 관리 화면에서 구분할 이름 |
| `expiresAt` | | 이 시각 이후 `410 Gone`. `Y-m-d H:i:s` |
| `forceNew` | | `true` 면 같은 URL 이어도 새 코드 발급 |

### Node.js / TypeScript

```typescript
const created = await sendgo.shortUrl.create({
  targetUrl: 'https://shop.example.com/promotions/autumn-2026',
  title: '가을 세일 랜딩',
  expiresAt: '2026-09-30 23:59:59',
});

const { code, shortUrl } = created.data;

await sendgo.sms.sendSms({
  content: `[이벤트] 가을 특가! ${shortUrl}`,
  contacts: [{ contact: '01012345678' }],
});
```

### Python

```python
created = client.short_url.create(
    target_url="https://shop.example.com/promotions/autumn-2026",
    title="가을 세일 랜딩",
)
link = created["data"]["shortUrl"]

client.sms.send_sms(
    content=f"[이벤트] 가을 특가! {link}",
    contacts=[{"contact": "01012345678"}],
)
```

### PHP

```php
<?php

$short = $sendgo->shortUrl->create([
    'targetUrl' => 'https://shop.example.com/promotions/autumn-2026',
    'title'     => '가을 세일 랜딩',
]);

$link = $short['data']['shortUrl'];

$sendgo->sms->sendSms([
    'content'  => "[이벤트] 가을 특가! {$link}",
    'contacts' => [['contact' => '01012345678']],
]);
```

## 클릭 통계 조회

```typescript
const stats = await sendgo.shortUrl.stats(code, { from: '2026-09-01' });

await sendgo.shortUrl.list({ count: 10 });   // 목록
await sendgo.shortUrl.show(code);            // 상세
await sendgo.shortUrl.deactivate(code);      // 리다이렉트 중지 (통계는 남는다)
```

```python
stats = client.short_url.stats(code, from_="2026-09-01")
client.short_url.list(count=10)
client.short_url.show(code)
```

```php
<?php

$stats = $sendgo->shortUrl->stats($code, ['from' => '2026-09-01']);
$sendgo->shortUrl->list(['count' => 10]);
$sendgo->shortUrl->show($code);
$sendgo->shortUrl->deactivate($code);
```

## 캠페인별로 통계 나누기

같은 랜딩 페이지를 여러 캠페인에서 쓴다면 `forceNew` 로 코드를 따로 발급받으세요. 그러지 않으면 통계가 한 코드에 합쳐져 어떤 캠페인이 효과가 있었는지 알 수 없습니다.

```typescript
const augustLink = await sendgo.shortUrl.create({
  targetUrl: 'https://shop.example.com/sale',
  title: '8월 세일 - 알림톡',
  forceNew: true,
});

const septemberLink = await sendgo.shortUrl.create({
  targetUrl: 'https://shop.example.com/sale',   // 같은 목적지
  title: '9월 세일 - 문자',
  forceNew: true,                                // 다른 코드
});
```

## 놓치기 쉬운 것

- **알림톡 템플릿에는 링크를 변수로 넣어야 합니다.** 템플릿 본문에 URL 을 고정하면 캠페인마다 재심사를 받아야 합니다. `#{var3}` 자리에 짧은주소를 넣으세요.
- **만료 시각을 정하세요.** 지난 이벤트 링크가 계속 살아 있으면 뒤늦게 눌린 사용자가 종료된 페이지를 봅니다.
- **짧은주소를 사이트맵에 넣지 마세요.** 추측 불가능한 코드가 곧 접근 통제인 경우가 있습니다.

## 다음 단계

- [SMS · LMS · MMS 보내기](/ko/cookbook/send-sms)
- [광고성 메시지 규칙](/ko/cookbook/ad-message-rules)