Emails
Chat and message routes work with customer conversations across internal messages, email, mission/project chat, WhatsApp-style inboxes, and channel-specific message lists.
Channels
- Customer chat is the customer timeline or internal customer conversation. Use customer_id when sending or loading customer messages.
- Mission chat is connected to a mission. Use mission_id and keep the mission/customer ids in UI state.
- Project chat is connected to a project and may also require customer_id when the message belongs to a customer/project relationship.
- Email routes handle email messages, marking read/unread, adding email messages, deleting, replying, and forwarding when allowed.
- Inbox/conversation routes return channel lists. Store the ids returned by list routes and reuse them for message routes.
What You Can Do
- List inboxes and conversations.
- Load messages for a customer, mission, project, or channel conversation.
- Send a new message when the user has permission for that channel.
- Chat.SendCustomer enforces the same channel gates as the dashboard composer: module_sidebarmenu_chat, account Chat settings, and active custom chat_channel_settings.
- Send.EmailTemplate: data JSON keys like cf-hello_1 replace {hello_1}/{cf-hello_1} in the template. Uses send_mail_client_new so messages appear in Emails / customer mail. Does not replace Chat.SendCustomer.
- Mark messages read, reply, forward, or delete when the channel and user permissions allow it.
Ids To Store
- customer_id for customer chat.
- mission_id for mission messages.
- project_id for project messages.
- message_id or messenger_meta_id for message actions.
- channel/token/owner values only when the specific route documents them; do not invent ids.
Realtime
- Message actions can push socket events so open UIs refresh without polling.
- A UI should listen to the socket event bus and refresh only the affected conversation or list.
Common Flow
- Login and call User.Basic for permissions and team settings.
- Open the needed list route, such as inbox/conversations/customer messages.
- Store returned ids with each UI item.
- Call send, mark-read, reply, forward, or delete routes with the stored ids.
- Refresh the list or conversation after success, and listen to socket events for live updates.