8

In official documentation of quick replies says:

Quick Replies work with all message types including text message, image and template attachments.

But when i try send it with template_type: button, I got error:

{
    "error": {
        "message": "(#100) Only one of text or attachment can be specified",
        "type": "OAuthException",
        "code": 100,
        "fbtrace_id": "H8w+ZfRbBub"
    }
}

That I try to send:

{
    "recipient": {"id": "234567890"},
    "message": {
        "text": "TEXT_MESSAGE",
        "quick_replies": [
            {
                "content_type": "text",
                "title": "SOME_TITLE_1",
                "payload": "PAY_LOAD_1"
            },
            {
            "content_type": "text",
            "title": "SOME_TITLE_2",
            "payload": "PAY_LOAD_2"
            }
        ],
        "attachment": {
            "type": "template",
            "payload": {
                "template_type": "button",
                "text": "TEXT_MESSAGE",
                "buttons": [
                    {
                        "title": "READ_MORE_BUTTON",
                        "type": "postback",
                        "payload": "look:1:c"
                    }
                ]
            }
        }
    }
}

when I sent without message.text, I got error:

{
    "error": {
        "message": "(#100) Cannot use both CTA and quick reply",
        "type": "OAuthException",
        "code": 100,
        "fbtrace_id": "C0DDxGzaUUj"
    }
}

What is CTA?

How send quick replies with attachment?

Dmitry
  • 2,057
  • 1
  • 18
  • 34
  • Oh I realize now that I was using a generic template as normal, and not trying to send the trio of: text, buttons, quick replies. Did you find a way to do this or a workaround? – user2322082 Jul 18 '16 at 19:41
  • @user2322082 not realy. I can send two different messages only. – Dmitry Jul 19 '16 at 07:15
  • So do you have to send a button message and then wait for the delivery and then send the quick replies? And is there even a way to send quick replies without some other sort of information? – user2322082 Jul 19 '16 at 12:25
  • 1
    Same problem here... Facebook documentation sucks so much! – Aurasphere Aug 28 '16 at 13:08
  • answer by Sajin gets directly to the point https://stackoverflow.com/questions/42672531/messenger-quick-response-does-not-trigger-postbak – ziadrida Apr 22 '18 at 05:10

4 Answers4

7

This message structure should work for sending an image attachment with quick replies:

{
    "recipient": {
        "id": recipient_id
    },
    "message": {
        "attachment":{
            "type":"image",
            "payload":{
                "url": image_url
            }
        },
        "quick_replies": [
            {
                "content_type":"text",
                "title": "Next Image",
                "payload": "YOUR_DEFINED_PAYLOAD_FOR_NEXT_IMAGE"
            }
        ]
    }
}

Hope that helps dmitry.

Community
  • 1
  • 1
Allan Berger
  • 391
  • 4
  • 6
4

try this way. It will insert both buttons and quick replies but button will be at top and quick replies will be at the bottom

"message":{
    "quick_replies":[
        {"content_type":"text",
        "title":"title1",
        "payload":"SUPPLEMENT_1"},
        {"content_type":"text",
        "title":"title2",
        "payload":"PAYLOAD_1"
        }
    ],
 "attachment":{
  "type":"template",
  "payload":{
    "template_type":"button",
    "text":"your text",
    "buttons":[
      {
        "type":"postback",
        "title":"Confirm",
        "payload":"USER_DEFINED_PAYLOAD"
      }
    ]
  }
 }
}
Dimuth Ruwantha
  • 671
  • 2
  • 12
  • 26
2

So, I've got your same problem and I did some searches around.

What does CTA stands for?

First of all, CTA stands for Call-To-Action. These are the buttons you create with a request for a Button Template, Generic Template or with the Persistent Menu Thread Settings.

It seems that, although as you said FB official documentation explicitly states that Quick Replies are supported with ANY template, for some reason this doesn't include the Button template.

Why is that?

It seems logical to me that the Button Template should be used to present the user with a choice, same thing that the Quick Replies do, so it would be redundant.

Why is that not documented?

I'm assuming that it's probably due to the fact that the Messenger Platform API is still in beta and there are lots of changes from day to day. Personally, I'm working on a Java framework for doing Facebook Messenger bots and I'm finding that many things are not very well documented and often the error messages you get back are misleading. So, you should probably accept the fact that the Button Template and Quick Replies doesn't work together. Quick Replies works with any other template or with text messages though.

Aurasphere
  • 3,841
  • 12
  • 44
  • 71
0

This worked for me while using dialogflow

{
  "facebook": {
    "attachment":{
      "type":"template",
      "payload":{
        "template_type":"generic",
        "elements":[
           {
            "title":"Welcome!",
            "image_url":"https://petersfancybrownhats.com/company_image.png",
            "subtitle":"We have the right hat for everyone.",
            "default_action": {
              "type": "web_url",
              "url": "https://petersfancybrownhats.com/view?item=103",
              "webview_height_ratio": "tall"
            },
            "buttons":[
              {
                "type":"web_url",
                "url":"https://petersfancybrownhats.com",
                "title":"View Website"
              },{
                "type":"postback",
                "title":"Start Chatting",
                "payload":"DEVELOPER_DEFINED_PAYLOAD"
              }              
            ]      
          }
        ]
      }
    },
     "quick_replies":[
      {
        "content_type":"text",
        "title":"Search",
        "payload":"<POSTBACK_PAYLOAD>",
        "image_url":"http://example.com/img/red.png"
      },
      {
        "content_type":"location"
      }
    ]
  }
}
Dipesh Lohani
  • 306
  • 3
  • 11