README.md

Twilio / Zendesk Integration Example

Copyright (c) 2011 D. Keith Casey Jr. "caseysoftware"

If you find this code useful, please let me know.

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

Background

Zendesk is a Helpdesk system for receiving and responding to trouble tickets,
support requests, etc. Each customer service people can jump into particlar
tickets/threads as they need. All exchanges are via email.

In this scenario, I plug into Twilio to allow SMS to replace email completely
and transparency. The flow is as follows:

A customer sends an SMS to a short/long code requesting support;

This script receives the incoming SMS and checks for an open ticket from this phone number:

If there is not a match, a new ticket is created using the body of the SMS and attaching the phone number as an attribute;

If there is a match, the SMS is appended to the existing ticket;

When a customer service representative responds to the ticket, an SMS is sent back out through Twilio to the original requestor;

Going forward, any incoming SMS to this number should generate a new ticket.
Any responses on that ticket will be sent to the original requestor via SMS.

Dependencies

This example code is based on two independent libraries which are included here
for completeness, not because there's any implied ownership, endorsement, etc.
They have their own licenses, you should follow them.