1

I want to make my ejabberd able to plan messages.

Which could be the best solution for this purpose?

And supposing that I have all the messages stored on the db, with the recipient (to) and with the date (year, month, day, hour..) when they must be send.

Which could be the best option to handle it?

A cronjob at every minute that checks if there are messages to send? And in this case, how could it tells to the Ejabberd that it have to send the message?

Another option to handle it?

Thanks!!!

Mickaël Rémond
  • 9,035
  • 1
  • 24
  • 44
joanlopez
  • 579
  • 1
  • 6
  • 17

2 Answers2

1

develop your own custom ejabberd module using one of these options - timer:apply_interval/4 or timer:apply_after/4 or implement built-in mechanism within gen_server to accomplish your task. Use ejabberd_router:route(From, To, Stanza) to send messages.

Sunil Singh
  • 538
  • 3
  • 12
  • Thanks!! It could be a good choice using the 'mod_cron' module and implementing my own function that checks on database if there are pending messages? – joanlopez Mar 04 '16 at 06:57
1

I would use the send_message API / Command from an external tool. That way you can do whatever you want in the programming language of your choice.

The send_message API is described here: https://docs.ejabberd.im/admin/api/#sendmessage---send-a-message-to-a-local-or-remote-bare-of-full-jid

Mickaël Rémond
  • 9,035
  • 1
  • 24
  • 44