Skip to content
This repository has been archived by the owner on Jul 9, 2022. It is now read-only.

Update getThreadHistory to return attachment.story_attachment.target #629

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ivankolesnikov
Copy link
Contributor

We are using facebook-chat-api to run end-to-end test for our chatbot. The bot itself uses official FB Messenger API. In the tests we want to assert that expected buttons are shown.

For example, we want to verify that a user receives a message with "Log In" and "Cancel" buttons. After the change the message looks like:

{
    "type": "message",
    "body": "I need you to login to your account to link it your Facebook profile before we can continue.",
    "attachments": [
      {
        ...,
        "target": {
          ...
          "call_to_actions": [
            {
              "action_link": "https://l.facebook.com/l.php?...",
              "action_open_type": "OPEN_URL",
              "title": "Log In",
              ...
            },
            {
              "action_link": "https://www.facebook.com/commerce/update/",
              "action_open_type": "POSTBACK",
              "title": "Cancel",
              ...
            }
          ]
        }
      }
    ],
    ...
  }

Note: in case non-GraphQL response (using utils.js) the target field is available and it works for us, but with the recent FB changes, we forced to use GraphQL to load a message, see #628

It is legacy but still useful to verify the buttons returned with the message
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant