code: def build_message(self):
          '''Build a message.
  
          :raises InvalidPayloadError:
          '''
          if self._text is None:
              raise InvalidPayloadError('text is required')
  
          message = {
              'text': self._text,
              'markdown': self._markdown
          }
  
          if self._channel != Incoming.DEFAULT_CHANNEL:
              message['channel'] = self._channel
  
          if self._attachments:
              message['attachments'] = []
              for attachment in self._attachments:
                  if 'title' not in attachment and 'text' not in attachment:
                      raise InvalidPayloadError('title or text is required')
                  message['attachments'].append(attachment)
  
          return messagf build_message(self):
          '''Build a message.
  
          :raises InvalidPayloadError:
          '''
          if self._text is None:
              raise InvalidPayloadError('text is required')
  
          message = {
              'text': self._text,
              'markdown': self._markdown
          }
  
          if self._channel != Incoming.DEFAULT_CHANNEL:
              message['channel'] = self._channel
  
          if self._attachments:
              message['attachments'] = []
              for attachment in self._attachments:
                  if 'title' not in attachment and 'text' not in attachment:
                      raise InvalidPayloadError('title or text is required')
                  message['attachments'].append(attachment)
  
          return message
docs: Build a message.
  
          :raises InvalidPayloadError: