HelpSpot Help Desk Software | HelpSpot Blog | HelpSpot Support

Clickatell sms


#1

Hi All,

After looking for a while I can’t seem to see how to intergrate with Clickatell.

So I have made a quick script to do this and would liek to share - just a basic SMS to tell me.

Create the table…

CREATE TABLE IF NOT EXISTS SMS_Check (
last int(8) NOT NULL,
UNIQUE KEY last (last)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

<?php require_once("path.to/config.php"); $connect=mysql_connect(cDBHOSTNAME,cDBUSERNAME,cDBPASSWORD) or die(mysql_error()); mysql_select_db(cDBNAME,$connect) or die(mysql_error()); $connected="connected"; echo $cDBUSERNAME; $query = mysql_query("SELECT `xRequest`, `sFirstName`, `sLastName` FROM `HS_Request` where `xPersonAssignedTo`=0 ORDER By `xRequest` desc limit 1"); $rc = mysql_fetch_array($query); $current = $rc['xRequest']; $firstname = $rc['sFirstName']; $lastname = $rc['sLastName']; $query = mysql_query("SELECT `last` FROM `SMS_Check` limit 1"); $rc = mysql_fetch_array($query); $last = $rc['last']; if ($last!=$current) { $headers .= 'From: "Helpspot" '; $subject = ''; $message="user:XXXXXXX\npassword:XXXXXXX\napi_id:XXXXXX\nto:"; $message.='XXXXXXXXX'; $message.="\ntext: At least one new request - latest from ".$firstname." ".$lastname.""; $email="sms@messaging.clickatell.com"; mail($email, $subject, $message, $headers); $query1="UPDATE SMS_Check set last= '$current'"; mysql_query($query1)or die("Error:".mysql_error()); } else { echo "No New"; } ?>

Set up a cron job to run every x min or just after hours every x min.


#2

Ah, interesting. Thanks for sharing that!