1.0.0 • Published 6 years ago

messenger-json-builder v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

messenger-json-builder Build Status

Helper utility to create Facebook Messenger JSON based on Templates.

Install

npm install messenger-json-builder

Usage

  import M from "messenger-json-builder";

  const coverImage = M.getImage(`${content.cover}`);

  const details = M.createElement([
    M.button({
      type: "web_url",
      url: `${PLAY_URL}/movies/${content.id}`,
      title: "See on Play!"
    }),
    M.button({
      type: "show_block",
      block_names: ["NewSearch"],
      title: "New Search"
    }),
    M.button({
      type: "show_block",
      block_names: ["EndSuccess"],
      title: "Thanks! See you!"
    })
  ]);

  const sinopsysText = M.getText(sinopsys);
  const detailsButtons = M.getButtons([sinopsysText, details]);
  return M.send([coverImage, detailsButtons]);

API

TODO

License

MIT © Gabriel Almeida