Actions20
- User Actions
- Course Actions
- Enrollment Actions
- Grade Actions
- Message Actions
Overview
This node operation retrieves messages from a specific conversation in Moodle's messaging system. It is useful when you want to fetch the entire message history of a particular conversation between users within Moodle. Typical scenarios include auditing communication, displaying conversation threads in external dashboards, or integrating Moodle conversations with other systems.
For example, if you have a conversation ID and the current user's ID, you can use this operation to get all messages exchanged in that conversation, enabling you to display the full chat history or analyze message content.
Properties
Name | Meaning |
---|---|
Conversation ID | The unique numeric identifier of the conversation from which to retrieve messages. |
Current User ID | The numeric ID of the current user requesting the conversation messages (required). |
Output
The output is an array of message objects representing individual messages within the specified conversation. Each message object typically contains details such as:
- Message content text
- Sender and recipient IDs
- Timestamp of when the message was created
- Other metadata related to the message
If no messages are found, the output will be an empty array.
The node does not output binary data for this operation.
Dependencies
- Requires a valid Moodle API connection configured with appropriate permissions.
- The Moodle instance must support the
core_message_get_conversation_messages
web service function, which is available in Moodle 3.6 or higher. - An API key credential or token with access to messaging functions is necessary.
Troubleshooting
Common Issues:
- Using this operation on Moodle versions earlier than 3.6 will fail because the required API function is unavailable.
- Providing incorrect conversation or user IDs will result in empty results or errors.
- Insufficient permissions for the API user may cause failures or empty responses.
Error Messages:
"Conversation messages API not available. This feature requires Moodle 3.6 or higher."
Cause: Moodle version too old or API function disabled.
Resolution: Upgrade Moodle or use alternative message retrieval methods like "Get Messages".- Errors related to invalid parameters usually indicate missing or wrong input values; verify that both Conversation ID and Current User ID are correctly set.
Links and References
- Moodle Messaging API documentation:
https://docs.moodle.org/dev/Message_API - Moodle Web Services overview:
https://docs.moodle.org/dev/Web_services - Moodle core_message_get_conversation_messages function (Moodle 3.6+):
https://github.com/moodle/moodle/blob/master/message/output/ajax/classes/api.php (search forcore_message_get_conversation_messages
)