def process_message_event(message, resource, token, config):
logging.debug('Processing message event')
try:
if str(message['_embedded']['message']['direction']) == 'Incoming':
message_uri = message['_embedded']['message']['_links']['plainMessage']['href']
logging.debug("Received raw message - %s" % message_uri)
inbound_message = urllib.unquote_plus(DataURI(message_uri).data)
logging.info("Received message - %s" % inbound_message)
thread_uri = message['_embedded']['message']['_links']['messaging']['href']
if MESSAGE_CALLBACK is not None:
MESSAGE_CALLBACK(inbound_message, thread_uri, resource)
# send_message(resource + thread_uri + '/messages', 'I found 4 matching incidents https://it12321.servicenow.com/search?query={0}'.format(inbound_message), token, config['redirect_uri'])
except KeyError:
logging.debug('not an inbound message')
pass
评论列表
文章目录