simonseo / nyuad-spammer

Subscribe to instant notifications from Student Portal. Don't miss Marvel movie tickets again!
14 stars 5 forks source link

Convert Announcement message content from HTML to plain text or text with buttons #3

Closed simonseo closed 6 years ago

simonseo commented 6 years ago

Currently, the "message" field of our CSV contains HTML-formatted content. We shouldn't pass this straight to the chatbot. We want the users to see plaintext with buttons instead of links.

simonseo commented 6 years ago

@anchor14 has an idea how we should deal with this.

I think this can be done either from the database or the chatbot server, but it would be better to do it in the chatbot server since each chatbot interface (FB, Telegram, etc) have different functionalities. I'm specifically thinking about links/buttons/email address/font transform

simonseo commented 6 years ago

Example:

      ....
      "title": "\"Just Another Accent\" Movie Premier ",
      "message": "<p>The Cultural Enegamnet Program is delighted to invite you to attend &quot;<em><strong>Just Another Accent</strong></em>&quot; movie premier.&nbsp;</p>
\r\n\r\n<p>A young Emirati woman uses her speech impediment as the catalyst to help others in the United Arab Emirates.<br />
\r\nThe documentary aims to raise awareness of stuttering and wipe off the stigma that has long been attached to it. The film also follows Farah Al Qaissieh&rsquo;s journey in supporting the stuttering community through her non-profit organization of Stutter UAE and the features other people who stutter and the issues they face in everyday life.<br />
\r\n<br />
\r\n<strong>EVENT DETAILS:</strong><br />
\r\nDocumentary Premiere @ NYUAD<br />
\r\nReception and Panel Discussion with the lead actress<br />
\r\nThursday, 5th of April, Location: A6 - 008<br />\r\n7:00 p.m. &ndash; 8:30 p.m</p>
\r\n\r\n<p><strong>RSVP here</strong>:&nbsp;<a href=\"https://goo.gl/xRZupr\">https://goo.gl/xRZupr</a></p>\r\n",
      "topic": "Community Life",
     .....
anchor14 commented 6 years ago

@arantzardzm I know a library that can do this, so we can look at it together.

simonseo commented 6 years ago

Flask seems to have something like this. Search Markup class in the above link

anchor14 commented 6 years ago

@simonseo We found a way to do this on the fb chatbot side. We will push it after we figure out how to send csv from flask to the fb server. (we just experimented it with chunks of html text with links and stuff in it.)