messenger-json-builder
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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

Package Sidebar

Install

npm i messenger-json-builder

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

7.43 kB

Total Files

6

Last publish

Collaborators

  • gbr