ChatAble - A chat system

Hey there :wave:

After some problems and delays, I would like to publish #chatable source code


There has been lots of Sneak Peeks in this post, but probably everyone wants the .AIA to see how ti has been made
http://community.thunkable.com/t/chatable-project/3077?u=barreeeiroo


I’m not going to make a very long post, as I think everything about the system has been already published in the upper topic

Also, I would like to say that if there are no errors reported, in a week I will make a tutorial for how to integrate my system in your apps in a very simple way, using the examples of a support helpdesk or game chat rooms :wink:


Well, here is the .AIA:

Compiled APK using my server:


The server files can be found here:

The database structure is here too:

-- phpMyAdmin SQL Dump
-- version 4.4.15.8
-- https://www.phpmyadmin.net
--
-- Servidor: localhost
-- Tiempo de generación: 24-06-2017 a las 08:58:50
-- Versión del servidor: 5.5.50-MariaDB
-- Versión de PHP: 5.4.16

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Base de datos: `ChatAble`
--

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `alerts`
--

CREATE TABLE IF NOT EXISTS `alerts` (
  `id` int(11) NOT NULL,
  `title` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `content` mediumtext COLLATE utf8_unicode_ci NOT NULL,
  `button` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
  `theme` enum('light','dark') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'dark',
  `image` varchar(10000) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Volcado de datos para la tabla `alerts`
--

INSERT INTO `alerts` (`id`, `title`, `content`, `button`, `theme`, `image`) VALUES
(1, 'Welcome', '<b>Thanks for using ChatAble</b><br>Hope you enjoy <i>;)</i>', 'Ok', 'light', 'https://s-media-cache-ak0.pinimg.com/originals/a9/69/a2/a969a2f2aa0cfebe48479abb318e5214.png');
-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `group_chats`
--

CREATE TABLE IF NOT EXISTS `group_chats` (
  `id` int(50) NOT NULL,
  `alias` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
  `title` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `password` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `creator` int(10) NOT NULL,
  `users` varchar(1000) COLLATE utf8_unicode_ci NOT NULL DEFAULT '1',
  `timestamp` varchar(25) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `group_messages`
--

CREATE TABLE IF NOT EXISTS `group_messages` (
  `id` int(255) NOT NULL,
  `group_id` int(50) NOT NULL,
  `sender_id` int(10) NOT NULL,
  `content` longtext COLLATE utf8_unicode_ci NOT NULL,
  `type` enum('text','image') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'text',
  `timestamp` varchar(25) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `private_chats`
--

CREATE TABLE IF NOT EXISTS `private_chats` (
  `id` int(100) NOT NULL,
  `user_server` int(50) NOT NULL,
  `user_client` int(50) NOT NULL,
  `timestamp` int(20) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `private_messages`
--

CREATE TABLE IF NOT EXISTS `private_messages` (
  `id` int(100) NOT NULL,
  `chat_id` int(50) NOT NULL,
  `sender_id` int(10) NOT NULL,
  `content` longtext NOT NULL,
  `type` enum('text','image','cleverbot') NOT NULL DEFAULT 'text',
  `timestamp` varchar(25) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `reader`
--

CREATE TABLE IF NOT EXISTS `reader` (
  `id` int(250) NOT NULL,
  `user_id` int(10) NOT NULL,
  `chat_id` int(50) NOT NULL,
  `counter` int(5) NOT NULL,
  `type` enum('private','group','support','unknown') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'unknown'
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `support_messages`
--

CREATE TABLE IF NOT EXISTS `support_messages` (
  `id` int(10) NOT NULL,
  `ticket_id` int(50) NOT NULL,
  `content` longtext COLLATE utf8_unicode_ci NOT NULL,
  `type` enum('title','text','image') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'text',
  `admin_msg` enum('true','false') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'false',
  `timestamp` varchar(30) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `support_tickets`
--

CREATE TABLE IF NOT EXISTS `support_tickets` (
  `id` int(10) NOT NULL,
  `user_id` int(10) NOT NULL,
  `admin_id` int(10) NOT NULL DEFAULT '0',
  `timestamp` int(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `users`
--

CREATE TABLE IF NOT EXISTS `users` (
  `id` int(10) NOT NULL,
  `username` varchar(30) NOT NULL,
  `email` varchar(50) NOT NULL,
  `password` varchar(100) NOT NULL,
  `admin` enum('true','false') NOT NULL DEFAULT 'false',
  `blocked` enum('true','false') NOT NULL DEFAULT 'false'
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;

--
-- Volcado de datos para la tabla `users`
--

INSERT INTO `users` (`id`, `username`, `email`, `password`, `admin`, `blocked`) VALUES
(1, 'system', 'bot@chat.thunkable.ga', 'null', 'true', 'false');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `versions`
--

CREATE TABLE IF NOT EXISTS `versions` (
  `id` int(10) NOT NULL,
  `versionCode` int(25) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Volcado de datos para la tabla `versions`
--

INSERT INTO `versions` (`id`, `versionCode`) VALUES
(1, 1);

--
-- Índices para tablas volcadas
--

--
-- Indices de la tabla `alerts`
--
ALTER TABLE `alerts`
  ADD PRIMARY KEY (`id`);

--
-- Indices de la tabla `group_chats`
--
ALTER TABLE `group_chats`
  ADD PRIMARY KEY (`id`);

--
-- Indices de la tabla `group_messages`
--
ALTER TABLE `group_messages`
  ADD PRIMARY KEY (`id`);

--
-- Indices de la tabla `private_chats`
--
ALTER TABLE `private_chats`
  ADD PRIMARY KEY (`id`);

--
-- Indices de la tabla `private_messages`
--
ALTER TABLE `private_messages`
  ADD PRIMARY KEY (`id`);

--
-- Indices de la tabla `reader`
--
ALTER TABLE `reader`
  ADD PRIMARY KEY (`id`);

--
-- Indices de la tabla `support_messages`
--
ALTER TABLE `support_messages`
  ADD PRIMARY KEY (`id`);

--
-- Indices de la tabla `support_tickets`
--
ALTER TABLE `support_tickets`
  ADD PRIMARY KEY (`id`);

--
-- Indices de la tabla `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`);

--
-- Indices de la tabla `versions`
--
ALTER TABLE `versions`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT de las tablas volcadas
--

--
-- AUTO_INCREMENT de la tabla `alerts`
--
ALTER TABLE `alerts`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT de la tabla `users`
--
ALTER TABLE `users`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT de la tabla `versions`
--
ALTER TABLE `versions`
  MODIFY `id` int(10) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

Hope this helps to users trying to integrate chat systems in their apps :+1:

Regards,
Diego

22 Likes

Thanks a lot, @Barreeeiroo!!!

2 Likes

thanks i get this error when opening app

You cannot just use his demo. You have to host your own Virtual Private Server (it costs minimum 1$/month) + you have to setup a database.

1 Like

But can you post the php files here? please!:anguished:

PHP Files can be downloaded from here:

Or with a direct download:
Download ZIP

2 Likes

Thanks a lot man!

Barreiro, I put my server information, but the incorrect key [318] insists to appear in screen 1.

Because you have set it too for the alerts/ folder I guess
Or just remove the alert notification system

Me parece mejor escribir en español. Cuando configuré mi servidor, el config.php tiene (const KEY = “”), debo crear una clave que sea igual a lo que aparece en index.php en “versions” y “alerts”?

Si has eliminado los servicios de version y alerts no es necesario, puedes dejarlos sin configurar
Sino, pueden ser distintos, pero es recomendable que sean iguales

He puesto el key igual en todos, pero sigue apareciendo como “incorrect key” en screen1. En las otras pantallas aparece “Wrong key size”. No soy programador, así que encuentro dificultades para identificar este problema. :frowning:

Puedes mandarme una foto del config.php y los bloques de la Screen1?

config.php da pasta core

<?php const KEY = ""; const DB_HOST = "mysql.hostinger.com.br"; const DB_USER = "u206003576_chat"; const DB_PASS = "chapolin"; const DB_NAME = "u206003576_chat"; // External APIs const CLEVERBOT = ""; // Place here your CleverBot API Token if you want a bot to talk with

Aquí tienes algo puesto o lo has eliminado por privacidad?


Creo que sería más fácil si me envías el .AIA y yo le hecho un vistazo

Yo había utilizado const KEY = “ChatAble”, igual al que aparece en index.php de las alerts y versionteste ChatAble.aia (805.0 KB)
s.
Estoy adjuntando el archivo .aia con los datos de mi servidor.
Muchas gracias por su ayuda!

Tienes que configurar las variables como están en la screen access:
ChatAble.aia (804.5 KB)

La Screen1 ya la he arreglado yo
Solo tienes que poner SERVER_URL a http://coletadomiciliar.net/ChatAble-master/ChatAble-master/
Y la API_URL function así:


En todas las pantallas

Gracias, hice las modificaciones, pero cuando coloca la “KEY” correcta, el sistema muestra un mensaje de “WRONG KEY SIZE” en todas las pantallas