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

[NEW] Twilio MMS support for LiveChat integration #7964

Merged
merged 8 commits into from
Apr 17, 2018

Conversation

t3hchipmunk
Copy link
Contributor

@RocketChat/core

This pull request adds the ability for the Twilio integration to accept MMS attachments and display the attachment in the LiveChat window.

image

@CLAassistant
Copy link

CLAassistant commented Aug 29, 2017

CLA assistant check
All committers have signed the CLA.

@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@t3hchipmunk
Copy link
Contributor Author

Sorry about the codacy messages. First time messing with those. I'll stop on that front unless it's required.

@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
@RocketChat RocketChat deleted a comment Aug 29, 2017
return returndata;
}

returndata.hasMedia = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are always setting hasMedia as true which is not correct.

for (let mediaIndex = 0; mediaIndex < NumMedia; mediaIndex++) {
const media = {
'url': '',
'contenttype': ''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use camel case properties, i.e: contentType

@@ -44,6 +44,30 @@ RocketChat.API.v1.addRoute('livechat/sms-incoming/:service', {
sendMessage.message.msg = sms.body;
sendMessage.guest = visitor;

if (sms.hasMedia) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will always enter on this if because hasMedia is always true, so it is not really needed.

@@ -44,6 +44,30 @@ RocketChat.API.v1.addRoute('livechat/sms-incoming/:service', {
sendMessage.message.msg = sms.body;
sendMessage.guest = visitor;

if (sms.hasMedia) {
sendMessage.message.attachments = [];
for (let mediaIndex = 0; mediaIndex < sms.media.length; mediaIndex++) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to use sms.media.map() to populate the attachments field to help code reading. but not really a must.

return {
let NumMedia = 0;

const returndata = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use camel case variables, i.e: returnData

@sampaiodiego
Copy link
Member

First of all, thank you for your contribution, it looks like a very cool feature to have 😄

I have made some comments, please let me know if you need any help..

sampaiodiego and others added 2 commits December 27, 2017 10:23
* Switch to camelcase
* Changed hasMedia (removed)
* use map instead of for loop for populating attachments
@t3hchipmunk
Copy link
Contributor Author

Updated and pushed changes based on feedback. Hopefully this is more in line with standards and CI and lint all report back fine.

@geekgonecrazy
Copy link
Contributor

@renatobecker @sampaiodiego looks like feedback has been addressed here. But enough time has passed it may need another looking.

@sampaiodiego
Copy link
Member

wow.. I missed the update here.. sry about that 😞

for sure I'll take a look soon

@izodzim
Copy link

izodzim commented Apr 13, 2018

Would love to see this integrated ASAP!

@sampaiodiego sampaiodiego changed the title [NEW] Add ability for LiveChat to integrate Twilio MMS [NEW] Twilio MMS support for LiveChat integration Apr 13, 2018
@sampaiodiego sampaiodiego added this to the 0.64.0 milestone Apr 13, 2018
@rodrigok rodrigok merged commit 2c856c0 into RocketChat:develop Apr 17, 2018
@rodrigok rodrigok mentioned this pull request Apr 28, 2018
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

Successfully merging this pull request may close these issues.

6 participants