botpress / v12

Botpress OSS – v12
https://v12.botpress.com
GNU Affero General Public License v3.0
83 stars 91 forks source link

Document using built-in content types #263

Closed azizkhani closed 6 years ago

azizkhani commented 6 years ago

Botpress

I'm going to write a bot for several platforms. From my point of view, I have to write a bot and run on different platforms but in general I have a few basic problems.

For example, when sending a message in a telegram, the following code should be written


const pickCategory = {
 reply_markup: {
        keyboard: [
          ['🍱 k2', '🛠 k1'],
          ['🛒 k3', '🚛 k4'],
        ]
      }
}
bp.telegram.sendText (event.chat.id, 'Hi' ,pickCategory);

And in Messenger Messenger, the following code is const pickCategory = {

const pickCategory = {
  quick_replies: [
    {
      content_type: 'text',
      title: '🔥 Work 🔥',
      payload: 'GET_VIDEO_WORK'
    },
    {
      content_type: 'text',
      title: '😌 Life Goals 🔥',
      payload: 'GET_VIDEO_LIFE'
    },
    {
      content_type: 'text',
      title: '💪 Gym 🔥',
      payload: 'GET_VIDEO_GYM'
    }
  ],
  typing: true
}

bp.messenger.sendText (event.user.id, 'hi', pickCategory);

Well, what's the solution? Should not it be a standard for all platforms, so that when it's written and executed, it's just a setting that will be based on which bot is on?  Therefore, the code is written only once and it is called only once. What is the plan to do?

slvnperron commented 6 years ago

@azizkhani The solution is Content Renderer. This is explained here: https://botpress.io/docs/beta/getting_started/trivia_content/

Content Renderer A Content Renderer defines how a Content Type gets rendered on the different channels.

Note: This is critical because every channel is different and has a different set of functionalities. You want to be able to customize and leverage the features of the different platforms to offer the best user experience as possible.

azizkhani commented 6 years ago

@slvnperron I suggest that botpress create a dsl for sending different message types. As we know, the messaging features on all platforms should not exceed 30. So just after creating this dsl, for each module written, a translator is written to convert the language created into the format of the platform. Why this does not work with botpress. I think this can solve a lot of problems and transfer many of the complexities into modules.

slvnperron commented 6 years ago

@azizkhani Thanks for the siggestion, already in progress here: https://github.com/botpress/botpress/tree/sp-content/packages/core/botpress-builtins/src

azizkhani commented 6 years ago

@slvnperron is any documentation about this feature and other roadmap? I will be happy to know what is your plan and can help your team in solve issues

slvnperron commented 6 years ago

@azizkhani No documentation yet but working on it. Our plan is to release this with the initial public Botpress X release in the next couple days!

epaminond commented 6 years ago

Done within https://github.com/botpress/botpress/pull/636