"""
Send Message
Send message via IM such as Messanger, Slack or MS Teams.
"""

name = "communication/send-message"
version = "2.0.1"

"""
Send Message
Sends message to one destination
"""
usecase SendMessage {
  input {
    """
    Destination
    Representation of a messaging destination. Can be ID or channel name, depending on the provider capability.
    """
    destination! string!

    """
    Text
    Text of the message
    """
    text! string!
  }

  result {
    """
    Destination
    Identifier of the destination where the message was sent.
    """
    destination

    """
    Message ID
    Identifier of the message that was sent
    """
    messageId
  }

  error {
    """
    Title
    A short, human-readable summary of the problem type.
    """
    title!

    """
    A human-readable explanation specific to this occurrence of the problem.
    """
    detail
  }

  example Successful {
    input {
      destination = 'C1H9RESGL',
      text = 'Our app has 1,000,000 subscribers!',
    }

    result {
      destination = 'C1H9RESGL',
      messageId = "1503435956.000247",
    }
  }

  example Failed {
    input {
      destination = 'random',
      text = 'Message to nonexistent destination',
    }

    error {
      title = 'channel_not_found',
    }
  }
}