diff --git a/spectrum/src/frontends/slack/SlackRTM.cpp b/spectrum/src/frontends/slack/SlackRTM.cpp index 3d1eff7bc81e6502c6712b3d3bc8370c0815b0ac..2070fe3fe8f7e0a82334e08aa7538181ead42c35 100644 --- a/spectrum/src/frontends/slack/SlackRTM.cpp +++ b/spectrum/src/frontends/slack/SlackRTM.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -94,7 +95,10 @@ void SlackRTM::handlePayloadReceived(const std::string &payload) { void SlackRTM::sendMessage(const std::string &channel, const std::string &message) { m_counter++; - std::string msg = "{\"id\": " + boost::lexical_cast(m_counter) + ", \"type\": \"message\", \"channel\":\"" + channel + "\", \"text\":\"" + message + "\"}"; + + std::string m = message; + boost::replace_all(m, "\"", "\\\""); + std::string msg = "{\"id\": " + boost::lexical_cast(m_counter) + ", \"type\": \"message\", \"channel\":\"" + channel + "\", \"text\":\"" + m + "\"}"; m_client->write(msg); }