Skip to content

Serve TwiML from our own app#761

Merged
zachmargolis merged 2 commits intomasterfrom
margolis-twilio-repeat
Dec 6, 2016
Merged

Serve TwiML from our own app#761
zachmargolis merged 2 commits intomasterfrom
margolis-twilio-repeat

Conversation

@zachmargolis
Copy link
Contributor

@zachmargolis zachmargolis commented Nov 22, 2016

Why:
So we can add "press 1 to repeat" behavior


(This is currently blocked on some Twilio integration SSL certificate issuesbasic auth environment variable configuration)

--

update! unblocked!

Copy link
Contributor

@jessieay jessieay left a comment

Choose a reason for hiding this comment

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

Some general comments from me -- looking good! 🚃

Copy link
Contributor

Choose a reason for hiding this comment

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

since this is a constant, what about naming it something clearer rather than requiring comment? eg: NUMBER_OF_TIMES_USER_CAN_REPEAT_CODE

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will fix!

Copy link
Contributor

Choose a reason for hiding this comment

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

do we need this comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll remove it

Copy link
Contributor

Choose a reason for hiding this comment

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

woah! I have never seen an .xml.slim file before! 😎

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I'm open to .xml.erb-ing this too? I figured since it's a dealbreaker to have malformed XML for the Twilio API, I'd make it harder to mess up? But I find ERBs easier to read sometimes

Copy link
Contributor

Choose a reason for hiding this comment

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

does this mean we remove protocol from L 19 now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unsure, this is for the router, and that's for the mailer...maybe the router encompasses the mailer?

Copy link
Contributor

Choose a reason for hiding this comment

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

not sure I understand this: too low for what?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So we want to limit the # of times the call can be looped, so I track this state via a URL parameter. When the the repeat_count tracks the value and counts down, so maybe I just should have specified "when the repeat_count gets to 1" -- will fix

Copy link
Contributor

Choose a reason for hiding this comment

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

is there a way to provide multiple language options with twilio?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I need to move this to be i18ned just like the message.

Twilio supports speaking in multiple languages, but we'd have to script the choice behavior, or get a language preference from the user ahead of time and just send that: https://support.twilio.com/hc/en-us/articles/223132827-What-languages-can-the-Say-verb-speak-

Copy link
Contributor

Choose a reason for hiding this comment

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

we are still sending the same message, shouldn't we still check for it in our specs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So now we're sending a URL to our own servers, and the response of that URL contains the message. The URL no longer contains the entire message anymore, so I figured I'd check for the most important part of the URL, which is the code parameter?

Copy link
Contributor

Choose a reason for hiding this comment

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

gotcha! makes sense.

Copy link
Contributor

Choose a reason for hiding this comment

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

would it make sense to interpolate the ENV vals in this string to make it more obvious what is going on here? Or would that obfuscate more than clarify?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it would obfuscate? I'll leave as-is for now?

Copy link
Contributor

Choose a reason for hiding this comment

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

nice! If were me I would probably just make this line its own private method, but up to you.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good idea!

@zachmargolis
Copy link
Contributor Author

@jessieay I believe this is unblocked now (going to deploy once more to test it) -- can you give it one last review?

@zachmargolis zachmargolis force-pushed the margolis-twilio-repeat branch from d4d8d24 to fc6b432 Compare December 6, 2016 01:02
Copy link
Contributor

@jessieay jessieay left a comment

Choose a reason for hiding this comment

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

💯 -- obv we should manually test, but code looks good to me!

)
end

def twimlet_url(code) # rubocop:disable Metrics/MethodLength
Copy link
Contributor

Choose a reason for hiding this comment

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

👏 glad to be done with this crazy method

@zachmargolis zachmargolis force-pushed the margolis-twilio-repeat branch from fed066d to c995f38 Compare December 6, 2016 21:53
**Why**:
So we can add "press 1 to repeat" behavior for a limited number
of retries
@zachmargolis zachmargolis force-pushed the margolis-twilio-repeat branch from c995f38 to 613afe9 Compare December 6, 2016 21:54
**Why**: Follow more rails-y naming conventions
@zachmargolis
Copy link
Contributor Author

zachmargolis commented Dec 6, 2016

Confirmed once more on dev, merging!

@zachmargolis zachmargolis merged commit a45b2e2 into master Dec 6, 2016
@zachmargolis zachmargolis deleted the margolis-twilio-repeat branch December 6, 2016 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants