Skip to main content

카카오챗봇 JSON helper

Project description

카카오톡 챗봇 빌더 도우미

Python언어 전용

소개

[!NOTE]
https://github.com/jcrist/msgspec 을 이용하여 serialization 합니다.

Python 언어로 카카오 챗봇 서버를 만들 때 좀 더 쉽게 JSON 메시지 응답을 만들 수 있게 도와줍니다.

SimpleText, SimpleImage, ListCard, Carousel, BasicCard, CommerceCard, ItemCard 등의

챗봇 JSON 데이터를 쉽게 만들 수 있도록 도와줍니다.

설치

pip install kakao-json

사용법

ListCard 예제

from kakao_json import Button, Kakao, ListItem


k = Kakao()

    k.add_qr("오늘", "카톡 발화문1")
    k.add_qr("어제")  # label becomes also messageText

    list_card = k.init_list_card().set_header("리스트 카드 제목")
    list_card.add_button(Button("그냥 텍스트 버튼", "message"))
    list_card.add_button(k.init_button("link label").set_link("https://google.com"))
    list_card.add_button(
        k.init_button("share label").set_action_share().set_msg("카톡에 보이는 메시지")
    )
    list_card.add_button(k.init_button("call label").set_number("010-1234-5678"))

    list_card.add_item(
        ListItem("title").set_desc("description").set_link("https://naver.com")
    )

    k.add_output(list_card)

    print(k.to_json())
{
  "template": {
    "outputs": [
      {
        "listCard": {
          "buttons": [
            {
              "label": "그냥 텍스트 버튼",
              "action": "message"
            },
            {
              "label": "link label",
              "action": "webLink",
              "webLinkUrl": "https://google.com"
            },
            {
              "label": "share label",
              "action": "share",
              "messageText": "카톡에 보이는 메시지"
            },
            {
              "label": "call label",
              "action": "phone",
              "phoneNumber": "010-1234-5678"
            }
          ],
          "header": {
            "title": "리스트 카드 제목!"
          },
          "items": [
            {
              "title": "title",
              "description": "description",
              "link": {
                "web": "https://naver.com"
              }
            }
          ]
        }
      }
    ],
    "quickReplies": [
      {
        "action": "message",
        "label": "오늘",
        "messageText": "오늘 공지 보여줘"
      },
      {
        "action": "message",
        "label": "어제",
        "messageText": "어제 공지 보여줘"
      }
    ]
  },
  "version": "2.0"
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kakao_json-1.0.4.tar.gz (24.7 kB view details)

Uploaded Source

Built Distribution

kakao_json-1.0.4-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file kakao_json-1.0.4.tar.gz.

File metadata

  • Download URL: kakao_json-1.0.4.tar.gz
  • Upload date:
  • Size: 24.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.6 Windows/10

File hashes

Hashes for kakao_json-1.0.4.tar.gz
Algorithm Hash digest
SHA256 581541619ce940fb290fd8926ace304117e5faa1404952c66e742362689376c3
MD5 069a1d7de893c2ffb66ca951e65c0941
BLAKE2b-256 ce2b5b6eba935378e990f809cda8f32f6524b7ca867c8106daf5c781540c27c4

See more details on using hashes here.

File details

Details for the file kakao_json-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: kakao_json-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.6 Windows/10

File hashes

Hashes for kakao_json-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 03a3686f796bd0c984fde66710c157054e8bdb692bfc4275751205dfade8334b
MD5 eb1f54da8d4d4eb49c866438046a7477
BLAKE2b-256 c9e9e6f8514fefe93907aba4ad0a3d658d96342ed221dfa8dfed62955b22a67a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page