Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misinterpretation of bot commands sent from iPhone Spark clients #1

Closed
ObjectIsAdvantag opened this issue May 15, 2017 · 3 comments
Closed
Assignees

Comments

@ObjectIsAdvantag
Copy link
Collaborator

ObjectIsAdvantag commented May 15, 2017

from Jan Neuzil

"I am currently developping a bot and I have encountered a problem, when you mention the bot from the mobile devices like iPhone, iPad. When you post the message to bot from PC, in the html you have e.g.- html:

'<p><spark-mention data-object-type="person" data-object-id="Y2lzY29xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx">SampleBotName</spark-mention> /help</p>'

but when mentioning from mobile device in the html is:

'<spark-mention data-object-id="349xxxxx-xxxx-xxxxx-xxxxxxx" data-object-type="person">SampleBotName</spark-mention> /help'

so there is missing base64 coding. So when using node-sparkbot node.js module, it doesn't fulfill one condition which would remove HTML tag in html parser function resulting in misinterpretation of bot commands. Is this an intended behaviour or it should be the same? Thank you very much.

@ObjectIsAdvantag
Copy link
Collaborator Author

ObjectIsAdvantag commented May 15, 2017

Good point Jan, we'll definitely need to create a workaround in the node-sparkbot library.

I raised this discrepancy among Spark clients to the Spark for Developer team, it's currently being escalated to the Spark clients team. If you're interested to get updates, you can ask devsupport@ciscospark.com to be added to issue 62735:

Background context: the text property cannot safely be used to trim bot mentions, as NickNames (Mentionned participants of the room) vary depending on the list of participants, and the raw text does not provide metadata about where the mentions is exactly. Therefore, the only way to trim the mention is to parse the HTML code. 

Request: we need some alignment and an article on Spark4Devs to explain how to safely trim the bot mention for Cisco Spark.

Here are the examples of how HTML code is generated:

Mac Desktop client: base64 ENCODED person id, AND <p> tag

"text": "hi Steve from the Mac Desktop client",
"html": "<p>hi <spark-mention data-object-type=\"person\" data-object-id=\"Y2lzY29zcGFyazovL3VzL1BFT1BMRS8wM2ZiZTEwOS0yM2Y2LTQ1OWItODFlNS02YzYxM2JhMWNhZTE\">Steve</spark-mention> from the Mac Desktop client</p>",

iPhone native client: base64 DECODED person id, NO <p> tag

"text": "Hi Steve S from my iPhone",
"html": "Hi <spark-mention data-object-id=\"92b3dd9a-675d-4a41-8c41-2abdf89f44f4\" data-object-type=\"person\">Steve S</spark-mention> from my iPhone",

Web client (Chrome Windows): base64 ENCODED person id, NO <p> tag

"text": "hi Valérie from Web client Chome on Windows",
"html": "hi <spark-mention data-object-type=\"person\" data-object-id=\"Y2lzY29zcGFyazovL3VzL1BFT1BMRS84ZjlhYmQ4ZS0yZTJiLTQ5MTYtOGJlZC0wMDMyZjRiYTU3YTM\">Valérie</spark-mention> from Web client Chome on Windows",

Windows desktop client: base64 ENCODED person id, AND <p> tag

"text": "hi Valérie from Windows Desktop",
"html": "<p>hi <spark-mention data-object-type=\"person\" data-object-id=\"Y2lzY29zcGFyazovL3VzL1BFT1BMRS84ZjlhYmQ4ZS0yZTJiLTQ5MTYtOGJlZC0wMDMyZjRiYTU3YTM\">Valérie</spark-mention> from Windows Desktop</p>",

@ObjectIsAdvantag
Copy link
Collaborator Author

ObjectIsAdvantag commented May 15, 2017

Then, in the interpreter both data-object-id and data-object-type need to be searched for in spark-mention

@ObjectIsAdvantag ObjectIsAdvantag changed the title misinterpretation of bot commands sent from Mac Spark clients misinterpretation of bot commands sent from iPhone Spark clients May 15, 2017
@ObjectIsAdvantag
Copy link
Collaborator Author

published on npm as part of v0.10.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant