← Voltar para Flows

Messaging Flow

Name
Messaging Flow
Description
Abertura de conversa, carregamento de histórico, envio de mensagem e marcação como lida.
Trigger Event
message_sent
Validated
Not Validated

Steps

  1. 1
    listConversations(Messaging Service)
    Input Mapping
    page: "{{event.page}}"
    filter: "{{event.filter}}"
    sortBy: "updatedAt"
    userId: "{{event.userId}}"
    pageSize: "{{event.pageSize}}"
    authToken: "{{event.authToken}}"
    sortOrder: "desc"
    Output Handlers
    Output KeyNext StepBranch To FlowMerge To Context
    successStep 2: getConversationYes
  2. 2
    getConversation(Messaging Service)
    Input Mapping
    page: "{{event.page}}"
    userId: "{{event.userId}}"
    pageSize: "{{event.pageSize}}"
    authToken: "{{event.authToken}}"
    sortOrder: "{{event.sortOrder}}"
    conversationId: "{{steps.1.data.items[0].conversationId}}"
    Output Handlers
    Output KeyNext StepBranch To FlowMerge To Context
    successStep 3: createMessageYes
  3. 3
    createMessage(Messaging Service)
    Input Mapping
    userId: "{{event.userId}}"
    content: "{{event.content}}"
    authToken: "{{event.authToken}}"
    contextId: "{{event.contextId}}"
    attachments: "{{event.attachments}}"
    contextType: "{{event.contextType}}"
    recipientId: "{{event.recipientId}}"
    conversationId: "{{steps.2.data.conversation.conversationId}}"
    idempotencyKey: "{{event.idempotencyKey}}"
    Output Handlers
    Output KeyNext StepBranch To FlowMerge To Context
    successStep 4: markConversationAsReadYes
  4. 4
    markConversationAsRead(Messaging Service)
    Input Mapping
    readAt: "{{event.readAt}}"
    userId: "{{event.userId}}"
    authToken: "{{event.authToken}}"
    conversationId: "{{steps.3.data.conversation.conversationId}}"
    Output Handlers
    Output KeyNext StepBranch To FlowMerge To Context
    successStep 5: sendNotificationYes
  5. 5
    sendNotification(Notification Service)
    Input Mapping
    data: "$step1.data"
    userId: "{{event.userId}}"
    payload: "{{steps.3.data.message}}"
    channels:
    0"push"
    1"in_app"
    authToken: "{{event.authToken}}"
    templateKey: "message_created"
    correlationId: "{{steps.3.meta.requestId}}"
    excludeSender: true
    recipientUserIds: "{{steps.3.data.conversation.participants}}"
    Output Handlers
    Output KeyNext StepBranch To FlowMerge To Context
    successYes