storycraft / node-kakao

Loco protocol compatible library
MIT License
409 stars 115 forks source link

Channel.sendTemplate function doesn't work since today. #169

Closed jipsoft1 closed 3 years ago

jipsoft1 commented 3 years ago

Describe the bug Channel.sendTemplate function doesn't work since today. It worked well until yesterday same code same version of node-kakao.

To Reproduce

  1. Install node-kakao@3.1.8
  2. Create instances of CustomAttachment and AttachmentTemplate class.
  3. Call Channel.sendTemplate function.
  4. Nothing happens.

Expected behavior LIST CAROUSEL must be sent.

Screenshots < a part of my code >

exports.sendCustomListSlide = async (_chat, slide, linkable) => {
    console.log(JSON.stringify(slide));
    var info = new K.CustomInfo('ListSlide', K.CustomType.CAROUSEL, "lizzybot", "#", "6.4.5", "6.4.5", "2.6.1", "2.3.5",
        undefined, undefined, undefined, undefined, false, true, false, false, false, true, false);

        var feedType = (linkable ? K.CustomType.LIST : K.CustomType.FEED);
        var carousel = new K.CustomCarouselContent (
        feedType,
        slide.map(feed => {
            console.log(feed);
            feed.buttons = feed.buttons || [];
            feed.images = feed.images || [];
            var list = new K.CustomListContent(
                new K.ListHeaderFragment(
                    new K.TextDescFragment(feed.text.replace('\n', ' '), feed.desc), undefined, undefined
                ),
                feed.items.map(item => {
                    //console.log(item.text, item.desc, item.url, item.image);
                    return new K.ListItemFragment(
                        new K.TextDescFragment(item.text, item.desc),
                        new K.URLFragment(...new Array(4).fill(item.url)),
                        new K.ImageFragment(item.image));
                }),
                K.CustomButtonStyle.VERTICAL,
                feed.buttons.map(button => {
                    return new K.ButtonFragment(button.text, "both", new K.URLFragment(...new Array(4).fill(button.url)));
                })
            );

            return list;
        }), undefined, undefined
    );

    var attachment = new K.CustomAttachment(info, carousel);
    var template = new K.AttachmentTemplate(attachment, "LizzyBot");
    console.log(template);
    return await _chat.Channel.sendTemplate(template);
}

< execution result > sshot01

storycraft commented 3 years ago

Seems like Kakao started filtering invalid custom type messages. But official client still use custom type for share features, you may be able to send if you fill valid values.

image

Marking as wontfix.

storycraft commented 3 years ago

Please do not post code as screenshot. Use code block ('Insert code' button) instead.

jipsoft1 commented 3 years ago

Thank you for your answer. How can I check which of the values I sent is the problem?

storycraft commented 3 years ago

Ref #176