61 lines
1.1 KiB
Python
61 lines
1.1 KiB
Python
name = "Get RMASS Message Attachment URL"
|
|
|
|
kind = "action"
|
|
|
|
alias = "getrmassattachmenturl"
|
|
|
|
depends = [
|
|
"synapsegetroomalias",
|
|
"synapsegetattachment",
|
|
]
|
|
|
|
showstatus = True
|
|
|
|
resolve = {
|
|
"get": {
|
|
"path": ["lastmessage", 0, "content", "com.loxthelion.rmass_message_id"],
|
|
"msgtype": ["outmessageitem", "content", "msgtype"],
|
|
}
|
|
}
|
|
|
|
isrequest = True
|
|
|
|
method = "GET"
|
|
|
|
#loaddata = [
|
|
# "access_token",
|
|
# "refresh_token",
|
|
#]
|
|
|
|
#savepath = os.environ["TOKEN_STORE"]
|
|
|
|
path = [
|
|
"https://rentmasseur.com/api/v1/media/upload?mediaType=30&conversationId=",
|
|
{"resolved": "path"},
|
|
]
|
|
|
|
outputs = {
|
|
"uploadurl": "url"
|
|
}
|
|
|
|
headers = {
|
|
"Authorization": {
|
|
"output": "access_token",
|
|
"prefix": "Bearer ",
|
|
},
|
|
}
|
|
|
|
filters = [
|
|
{
|
|
"filterkey": "msgtype",
|
|
"operator": "==",
|
|
"filtervalue": "m.text",
|
|
"print": f"No image detected. Bypassing attachment push",
|
|
},
|
|
{
|
|
"filterkey": "event_id",
|
|
"operator": "==",
|
|
"filtervalue": {"outputs": "db_event_id"},
|
|
"print": f"Message already delivered. Bypassing {name}",
|
|
},
|
|
] |