Figure out how to deal with incoming messages
Closed this issue · 2 comments
calmcl1 commented
Figure out how to deal with incoming messages - will need to register them...?
Will this be done from the plugin end?
calmcl1 commented
A handy start might be for each plugin to have an endpoint initiatied automatically, like my-voluble-server-here.com/plugins/my-plugin-dir-name-here/endpoint
, which can call something like a onMessageRecieved
function on the plugin, maybe after doing some validation to register the message in the DB, figure out who the contact is, figure out if it's in part of a conversation, that sort of thing.
calmcl1 commented
The message identification/validation flow might be something like:
- (For SMS) See which number the endpoint recieved the message from (i.e. who the recipient is), which allows us to identify which Organization is the intended recipient
- See if the origin number is registered within that Organization and if so, identify the Contact
- Figure out if the Message is part of a conversation? This might be a down-the-line feature.
- Register the message in the database.
- Pass this on to the worker, which can call something like
onMessageReceived
for the relevant plugin - Maybe setup some sort of event which a website can listen to for incoming messages...?