Botpress: Can't send hashtags

Created on 28 Aug 2017  路  4Comments  路  Source: botpress/botpress

First off, thanks for amazing framework! I've used Botkit and Microsoft Bot Framework before, Botpress is much better :+1:

However, I can't send hashtags in the messages.

content.yml:

news:
  - on: facebook
    template_type: generic
    elements:
      - title: {{{title}}}
        default_action:
          type: web_url
          url: {{{url}}}
          webview_height_ratio: compact
          webview_share_button: hide
        buttons:
          - type: postback
            title: Process
            payload: PROCESS
          - type: postback
            title: Skip
            payload: SKIP

index.js:

event.reply('#news', {
  title: 'Saxo Bank Offers Bitcoin Exchange Traded Notes #Bitcoin',
  url: 'https://twitter.com/BTCTN/status/902225054523674626'
})

The "#Bitcoin" part gets chopped off. It happens because it's treated as comment by YAML parser, which runs after Mustache promptly replaces {{{title}}} with actual title.

Suggested fix:

  • Load content.yml once at startup.
  • Run Mustache each time before sending bloc.

Most helpful comment

Thanks Denis, totally agree with the fix! We should also actually only replace the mustache for the bloc currently in use (which is not the case atm).

In the mean time, you could use "{{{title}}}" (i.e. double quotes)

A PR would be awesome :)

All 4 comments

Thanks Denis, totally agree with the fix! We should also actually only replace the mustache for the bloc currently in use (which is not the case atm).

In the mean time, you could use "{{{title}}}" (i.e. double quotes)

A PR would be awesome :)

@slvnperron thanks for suggesting double quotes - it worked!

Can't work on a PR right now due to a deadline, but will keep it in mind for future)

I want to know your opinions. But for me, this is not a problem at all and issue can be closed, it's a characteristic of yaml and it's well documented.

Sure thing, agreed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

azizkhani picture azizkhani  路  6Comments

mhjb picture mhjb  路  3Comments

rt3norio picture rt3norio  路  7Comments

crixx picture crixx  路  5Comments

BPMJoannette picture BPMJoannette  路  3Comments