I have a plugin that hooks into the event PublicApi.ConversationMessages.Events.BeforeCreate - I need to intercept the sender and recipient as I have some custom logic I need to run to determine if the two individuals can contact eachother.
I'm not certain how to get the recipient.
I am on Version 9.0
Participant list on the Conversation should include all the members who would receive the message (including the sender). The currently logged in user would be the one who sent the message.
Mathew D'Amico - I'm not seeing that available. Or do I need to take the Conversation ID and actually get the object from the API?
However, I would ideally like to call this OnBeforeCreate - because if I detect I have two people that should not be able to PM each other, I want to throw an exception and kill the conversation before it is saved.
Doesn't look like there is an event available to get to the BeforeCreate of a Conversation. So the best you can do is the BeforeCreate on the ConversationMessage. Load the conversation and then delete it from there based on your logic.
Ok. Will there be any notifications sent? Or if I delete the conversation before the ConversationMessage is created will that fix it?