Esempio n. 1
0
def SendSymphonyMessage_noBotLog(streamId, message: str):
    if not message.startswith('<messageML>'):
        message = FormatSymphonyMessage(message)

    messageEP = config.GetSendMessageEndpoint(streamId, config.MessageMLVersion.v1)

    bodyJSON = {"message": message, "format": "MESSAGEML"}

    #botlog.LogSymphonyInfo('Sending Symphony Message | StreamId: ' + streamId + ' | Message: ' + message)
    return callout.SymphonyPOST(messageEP, json.dumps(bodyJSON))
Esempio n. 2
0
def SendUserIM(userIds, message, endpointVersion='v1', data=None):
    # createEP = config.SymphonyBaseURL + '/pod/v1/im/create'
    # createEP = endpointIM.substitute(host=config.SymphonyBaseURL, imVersion=endpointVersion)

    createEP = config.CreateIMEndpoint
    body = [int(uid) for uid in userIds]
    response = callout.SymphonyPOST(createEP, json.dumps(body))
    streamId = response.ResponseData.id

    if endpointVersion == 'v1':
        SendSymphonyMessage(streamId, message)
    else:
        SendSymphonyMessageV2(streamId, message, data)
Esempio n. 3
0
def SendSymphonyMessage(streamId, message: str):
    if not message.startswith('<messageML>'):
        message = FormatSymphonyMessage(message)

    # messageEP = config.SymphonyBaseURL + '/agent/v2/stream/' + streamId + '/message/create'
    # messageEP = endpointRoom.substitute(host=config.SymphonyBaseURL, roomVersion='v2', streamId=streamId)
    messageEP = config.GetSendMessageEndpoint(streamId,
                                              config.MessageMLVersion.v1)

    bodyJSON = {"message": message, "format": "MESSAGEML"}

    botlog.LogSymphonyInfo('Sending Symphony Message | StreamId: ' + streamId +
                           ' | Message: ' + message)
    return callout.SymphonyPOST(messageEP, json.dumps(bodyJSON))
def CreateDataFeed():
    datafeedEP = config.SymphonyBaseURL + '/agent/v1/datafeed/create'
    #datafeedEP = config.SymphonyBaseURL + '/agent/v4/datafeed/create'
    #time.sleep(5)
    return callout.SymphonyPOST(datafeedEP, None).ResponseData.id