99 lines
2.1 KiB
Python
99 lines
2.1 KiB
Python
import os
|
|
|
|
from . import synapsenotify
|
|
|
|
name = "RMASS Attachment Push"
|
|
|
|
alias = "rmassattachmentpush"
|
|
|
|
depends = [
|
|
"synapsegetroomalias",
|
|
"synapsegetattachment",
|
|
"getrmassattachmenturl",
|
|
"synapseattachmenttormass",
|
|
"getrmassattachmentid",
|
|
]
|
|
|
|
kind = "action"
|
|
|
|
showstatus = True
|
|
|
|
#Resolve sources its data from outputs. Ensure keys are in outputs
|
|
resolve = {
|
|
"get": {
|
|
"rmass_user": ["room_alias"],
|
|
#"event_id": ["outmessageitem", "event_id"],
|
|
"message_body": ["outmessageitem", "content", "body"],
|
|
"msgtype": ["outmessageitem", "content", "msgtype"],
|
|
"room_id": ["outmessageitem", "room_id"],
|
|
#"timestamp": ["outmessageitem", "origin_server_ts"],
|
|
"rmass_attach": ["response_list", 0, "id"],
|
|
"path": ["lastmessage", 0, "content", "com.loxthelion.rmass_message_id"],
|
|
#"attachment": ["outmessageitem", "url"],
|
|
#"msg_type": ["outmessageitem", "type"],
|
|
#"echo_tag": ["outmessageitem", "content", "com.loxthelion.rmass_message_id"],
|
|
},
|
|
"deconstruct": {
|
|
"rmass_user" : [
|
|
"#rmass_dm_",
|
|
":loxthelion.com",
|
|
],
|
|
},
|
|
"construct": {
|
|
"rmass_attach" : [
|
|
"a_",
|
|
{"resolved": "rmass_attach"},
|
|
],
|
|
},
|
|
}
|
|
|
|
keys = [
|
|
{
|
|
"keytitle": "message",
|
|
"keyvalue": {
|
|
"resolved": "message_body",
|
|
},
|
|
},
|
|
#{
|
|
# "keytitle": "message",
|
|
# "keyvalue": "Here's a photo!",
|
|
#},
|
|
#{
|
|
# "keytitle": "profileId",
|
|
# "keyvalue": {
|
|
# "resolved": "rmass_user",
|
|
# },
|
|
#},
|
|
{
|
|
"keytitle": "attachmentIds",
|
|
"keyvalue": {
|
|
"resolved": "rmass_attach",
|
|
},
|
|
},
|
|
]
|
|
|
|
method = "POST"
|
|
|
|
path = [
|
|
"https://rentmasseur.com/api/v1/mailbox/",
|
|
{"resolved": "path"},
|
|
]
|
|
|
|
headers = {
|
|
"Authorization": {
|
|
"output": "access_token",
|
|
"prefix": "Bearer ",
|
|
},
|
|
}
|
|
|
|
|
|
##Filter test against recursiveset
|
|
|
|
filters = [
|
|
{
|
|
"filterkey": "msgtype",
|
|
"operator": "==",
|
|
"filtervalue": "m.text",
|
|
"print": f"No image detected. Bypassing attachment push",
|
|
},
|
|
] |