#SMSGatewayGammu - Membuat trigger MySQL SMS autoreply dengan format tertentu

2
4957
Halaman:
1
2
Sertakan sumber dengan jelas jika ingin mencopy. Selalu cek tanggal, karena mungkin ada beberapa artikel lama yang belum disesuaikan dengan fakta terbaru

Membuat trigger MySQL SMS autoreply. Sudah sampai mana sob projectnya???? Kali ini saya kan mengulas cara sederhana untuk autoreply  pada SMSGateway dengan API Gammu database MySQL.  Tidak perlu pake bahasa program buat interface Perl, PHP, VB, C++ dll. Itu semua hanya untuk menampilkan database dan untuk proses yang lebih rumit.

Tapi kalau sekedar autoreply/ balasan sms otomatis gammu  dengan konsep yang simpel,  pakai trigger MySQL sudah bisa kok sob. Misalnya untuk jawaban otomatis yang tidak memakai hitungan. Seperti info data mahasiswa, info data barang dll yang tidak ada hitungan rumit di dalamanya.

Konsep Membuat Trigger MySQL SMS autoreply

Konsepnya Membuat trigger MySQL SMS autoreply sangat sederhana :

  1. User request SMS dengan format tertentu.
  2. Format benar, reply dengan jawaban A (Mengambill nilai dari table A)
  3. Format salah, reply dengan jawaban B (Langsung reply format salah)

Minimum requirement Membuat trigger MySQL SMS autoreply. :

  1. Gammu (tested on gammu 1.33), your gammu service must be running without problem (can receive and sending message with MySQL)
  2. Database Standart gammu on MySQL (Inbox, Outbox,Sentitems) ditambah satu tabel untuk data (penulis menggunakan tabel data_user)
  3. Mastering of CRUD (Create, Read,Update,Delete) on MySQL
  4. Mastering of these function : length (menghitung string),  count (menghitung jumlah baris),  substr (memisahkan string), concat (menggabungkan string dari beberapa field dan atau string baru).
  5. You should be able to insert row with "select from another table"
  6. Mastering of MySQL Triggers
  7. Database saya beri nama 'sms_gateway', bila berbeda sesuaikan dengan yang akan dipakai.
Artikel Terkait :  #SMSGateway Installasi dan Pengaturan Gammu - SMS Gateway 2

Gimana sob, dah siap????




Lets Do IT!!! Mastering Create AutoReply SMS using Trigger on MySQL Membuat trigger MySQL SMS autoreply

Prepare your data

If you have one, skip this step (Jika pake data sendiri, triggernya menyesuaikan ya sob)

You should have outbox, inbox, sentitems and one table for your data. Well,  I give an example :

Bisa pakai cmd (MySQL Client bawaan) , MySQl Yog atau PHPMyAdmin dll yang penting bisa buat query

Create Data User Table

This script bellow will create table named 'data-user' . Field :ID (PrimaryKey),name, handphone,email,address

CREATE TABLE `sms_gateway`.`data-user`(
`id` INT(4) NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(30) DEFAULT 'paijo' ,
`handphone` VARCHAR(15) DEFAULT '082123456789' ,
`email` VARCHAR(30) DEFAULT '[email protected]' ,
`address` VARCHAR(50) DEFAULT 'jl.Paijo No. 10 Kota Paijo' ,
PRIMARY KEY (`id`)
)

Insert sample data to your table ;

This script will insert 3 rows.  Only name and handphone are will be filled

INSERT INTO `data_user` (`name`,`handphone`) VALUES ('painem','1234'),('paijan','4321'),('paijo','11111');

Halaman selanjutnya : Membuat trigger MySQL SMS autoreply

2 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.