

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# CreateWhatsAppMessageTemplate API를 사용하여 메시지 템플릿 생성
<a name="create-message-templates-api"></a>

API를 사용하여 사용자 지정 WhatsApp 메시지 템플릿을 생성할 수 있습니다. 이 주제에서는 [CreateWhatsAppMessageTemplate](https://docs.aws.amazon.com/social-messaging/latest/APIReference/API_CreateWhatsAppMessageTemplate.html)을 사용하여 다양한 메시지 템플릿을 생성하는 방법을 설명합니다.

## 메시지 템플릿 구성 요소
<a name="message-template-components"></a>

 메시지 템플릿에는 다음 구성 요소가 포함될 수 있습니다.
+ **헤더**: 상단에 나타나는 제목 텍스트
+ **본문**: 변수 자리 표시자가 있는 기본 메시지 콘텐츠
+ **바닥글**: 하단의 추가 정보
+ **버튼**: URLs에 연결되는 클릭 가능한 요소

다음 예제에서는 {{ENDPOINT}} 및 {{WABA\_ID}}를 실제 엔드포인트 URL 및 ID로 바꿉니다.

## 기본 영어 유틸리티 템플릿 생성
<a name="simple-body-only-utility-template"></a>

이 예제에서는 구성 `BODY` 요소만 사용하고 , `HEADER` `FOOTER`또는 `BUTTON` 구성 요소를 포함하지 않는 유틸리티 메시지 템플릿을 영어로 생성합니다. 본문 텍스트는 가변 자리 표시자를 사용합니다.

```
$ aws socialmessaging create-whatsapp-message-template --region {{us-east-1}} --endpoint-url {{ENDPOINT_URL}} \ 
--id {{WABA_ID}} \ 
--template-definition '{
    "name": "order_update_basic",
    "language": "en_US",
    "allow_category_change": true,
    "category": "UTILITY",
    "components": [
        {
            "type": "BODY",
            "text": "Hi {{1}}, your order #{{2}} has been shipped. Track your delivery below."
        }
    ]
}'
```

## 버튼을 사용하여 기본 영어 유틸리티 템플릿 생성
<a name="utility-template-with-button-example"></a>

이 예제에서는 `BODY` 및 `BUTTON` 구성 요소를 포함하는 영어 유틸리티 메시지 템플릿을 생성합니다.

```
$ aws socialmessaging create-whatsapp-message-template --region {{us-east-1}} --endpoint-url {{ENDPOINT_URL}} \
--id {{WABA_ID}} \
--template-definition '{
    "name": "order_update_with_button",
    "language": "en_US",
    "allow_category_change": true,
    "category": "UTILITY",
    "components": [
        {
            "type": "BODY",
            "text": "Hi {{1}}, your order #{{2}} has been shipped. Track your delivery below."
        },
        {
            "type": "BUTTONS",
            "buttons": [
                {
                    "type": "URL",
                    "text": "Track Order",
                    "url": "https://example.com/track"
                }
            ]
        }
    ]
}'
```

## 헤더, 본문 및 버튼을 사용하여 복잡한 영어 유틸리티 메시지 템플릿 생성
<a name="utility-template-button-header"></a>

이 예제에서는 `HEADER``BODY`, 및 `BUTTON` 구성 요소를 포함하는 유틸리티 메시지 템플릿을 영어로 생성합니다.

```
$ aws socialmessaging create-whatsapp-message-template --region {{us-east-1}} --endpoint-url {{ENDPOINT_URL}} \
--id {{WABA_ID}} \
--template-definition '{
  "name": "account_creation_confirmation_3333",
  "category": "UTILITY",
  "language": "en_US",
  "status": "APPROVED",
  "components": [
    {
      "type": "HEADER",
      "format": "TEXT",
      "text": "Finalize account set-up"
    },
    {
      "type": "BODY",
      "text": "Hi {{1}},\n\nYour new account has been created successfully. \n\nPlease verify {{2}} to complete your profile.",
      "example": {
        "body_text": [
          [
            "John",
            "your email address"
          ]
        ]
      }
    },
    {
      "type": "BUTTONS",
      "buttons": [
        {
          "type": "URL",
          "text": "Verify account",
          "url": "https://www.example.com/"
        }
      ]
    }
  ]
}'
```

## 기본 마케팅 메시지 템플릿 생성
<a name="simple-marketing-template"></a>

이 예제에서는 `BODY` 구성 요소만 포함하는 기본 마케팅 메시지 템플릿을 생성합니다.

```
$ aws socialmessaging create-whatsapp-message-template --region us-east-1 --endpoint-url {{ENDPOINT_URL}} \
--id {{WABA_ID}} \ 
--template-definition '{
  "id": "1290345849293233",
  "name": "holiday_special_1395238",
  "category": "MARKETING",
  "language": "en_US",
  "status": "PENDING",
  "components": [
    {
      "type": "BODY",
      "text": "Season's Greetings {{1}}!\n\nCelebrate {{2}} with amazing deals up to {{3}} off.\n\nPlus, get free gift wrapping on all orders above $50.",
      "example": {
        "body_text": [
          [
            "Pawan",
            "Christmas",
            "30%"
          ]
        ]
      }
    }
  ],
  "metaTemplateId": "1290345849293233"
}'
```

## 복잡한 마케팅 메시지 템플릿 생성
<a name="full-marketing-template"></a>

이 예제에서는 `HEADER``BODY`, 및 `BUTTON` 구성 요소를 포함하는 영어 마케팅 메시지 템플릿을 생성합니다.

```
$ aws socialmessaging create-whatsapp-message-template --region us-east-1 \
--endpoint-url {{ENDPOINT_URL}} \ 
--id {{WABA_ID}} \
--template-definition '{
  "name": "summer_sale_1",
  "category": "MARKETING",
  "language": "en_US",
  "status": "APPROVED",
  "components": [
    {
      "type": "HEADER",
      "format": "TEXT",
      "text": "Summer Sale!"
    },
    {
      "type": "BODY",
      "text": "Hi {{1}}! Get {{2}} off all summer items. Shop now before stock runs out!"
    },
    {
      "type": "FOOTER",
      "text": "Valid until August 31st"
    },
    {
      "type": "BUTTONS",
      "buttons": [
        {
          "type": "URL",
          "text": "Shop Now",
          "url": "https://example.com/sale"
        }
      ]
    }
  ]
}'
```