Botkit: getting encoding message issue when sent ordinary text

Created on 27 Jun 2017  路  12Comments  路  Source: howdyai/botkit

when i sent Ooops, something went wrong!, it displays Ooops, something went wrong%21
the ! char encoded to %21

how to resolve it?

help wanted stale

Most helpful comment

The issue description here is ambiguous, but I'm encountering this when sending messages from the bot. Some random outgoing messages will be url-encoded, with normal characters like apostrophe coming out as '.

My workaround is to use a send middleware to decode:

import { decode } from 'he';

controller.middleware.send.use((bot, message, next) => {
  // Decode outgoing messages to make sure there are no weird URI encoded characters.
  // Encoding happens automatically sometimes for unknown reasons.
  message.text = decode(message.text);

  next();
});

Note: These issues occur with the Twilio adapter, but the Emulator works fine.

All 12 comments

Can you post a snippet of your code?

i used the sample using with replyPrivateDelayed & replyPublicDelayed

And you didnt edit any code? Did you follow the instructions as he posted on the medium article?
https://api.slack.com/tutorials/easy-peasy-slash-commands

My guess without seeing your project that either you copy pasted some bad code, or missed a step.

hmm, just use Delayed version, you'll reproduce it, I properly followed and configured!

@peterswimm did you try it?

@hbakhtiyor I did not! You might also try posting the question in our deve community if you are 100% sure about your code and Slack side setup:

https://community.botkit.ai/

Any more on this? Having encoding issues with Slack and the / character.
1/1 becomes 1/1

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

up

Have you tried with this #240 ?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

The issue description here is ambiguous, but I'm encountering this when sending messages from the bot. Some random outgoing messages will be url-encoded, with normal characters like apostrophe coming out as '.

My workaround is to use a send middleware to decode:

import { decode } from 'he';

controller.middleware.send.use((bot, message, next) => {
  // Decode outgoing messages to make sure there are no weird URI encoded characters.
  // Encoding happens automatically sometimes for unknown reasons.
  message.text = decode(message.text);

  next();
});

Note: These issues occur with the Twilio adapter, but the Emulator works fine.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dfischer picture dfischer  路  4Comments

TheJimFactor picture TheJimFactor  路  4Comments

JonnyBoy333 picture JonnyBoy333  路  3Comments

znat picture znat  路  4Comments

abinashmohanty picture abinashmohanty  路  4Comments