Hello everyone, I’m developing a gateway plugin to communicate with my http api to send messages via whatsapp, but I’m having a problem where the message goes to the queue and has a pending status.
That can be because several issue, you can set the log to 3 and try again, share here when possible (please leave out real life info when sharing logs)
anton
So anton, I managed to create the plugin, change the log level and solve the problem. I would like to contribute to the project, how can I help? make my plugin available to everyone, my plugin is an integration with the whaticket platform for sending messages via WhatsApp, could you take a look?
repository link: GitHub - LSaints/plugin-whaticket: playSMS gateway plugin for Whaticket whatsapp message
thank you very much for the help
Codes looks good, some changes for next release is to use prepared statements:
Example codes:
$db_query = "
INSERT INTO " . _DB_PREF_ . "_gatewayWhaticket_log
(local_smslog_id, remote_smslog_id)
VALUES ('$smslog_id', '$c_message_id')";
$id = @dba_insert_id($db_query);
For next release that should be:
$db_query = "
INSERT INTO " . _DB_PREF_ . "_gatewayWhaticket_log
(local_smslog_id, remote_smslog_id)
VALUES (?,?)";
$id = dba_insert_id($db_query, [$smslog_id, $c_message_id]);
As for including this gateway to playSMS I will consider
Changes made, I also changed it to use tpl template
Alright, looks good to me, with some notes about the query:
This part:
I suggest to also use prepared statement:
$db_query = "
UPDATE " . _DB_PREF_ . "_gatewayWhaticket_config
SET cfg_api_url=?,
cfg_token=?";
if (dba_affected_rows($db_query, [$api_url, $token])) {
And this part:
I also suggest to use prep stmnt:
UPDATE " . _DB_PREF_ . "_messages
SET status='sent'
WHERE id=?";
dba_query($update_query, [$smslog_id]);
Anton