86 lines
1.6 KiB
Python
86 lines
1.6 KiB
Python
import os
|
|
|
|
name = "Synapse Message Push"
|
|
|
|
kind = "action"
|
|
|
|
showstatus = True
|
|
|
|
recursive = {
|
|
"source": "messages",
|
|
"reverse": True,
|
|
"label": "messageitem",
|
|
}
|
|
|
|
resolve = {
|
|
"get": {
|
|
"sender": ["messageitem", "senderId"],
|
|
"message_id": ["messageitem", "id"],
|
|
"message_body": ["messageitem", "text"],
|
|
"room_id": ["dmroom_id"],
|
|
"timestamp": ["messageitem", "createdAt"],
|
|
},
|
|
"construct": {
|
|
"matrixuser": [
|
|
"@rmass_",
|
|
{"resolved": "sender"},
|
|
":loxthelion.com",
|
|
],
|
|
},
|
|
"transform": {
|
|
"matrixuser": {
|
|
"@rmass_238302:loxthelion.com": "@lyncoln:loxthelion.com",
|
|
},
|
|
},
|
|
}
|
|
|
|
keys = [
|
|
{
|
|
"keytitle": "msgtype",
|
|
"keyvalue": "m.text",
|
|
},
|
|
{
|
|
"keytitle": "body",
|
|
"keyvalue": {
|
|
"resolved": "message_body",
|
|
},
|
|
},
|
|
{
|
|
"keytitle": "format",
|
|
"keyvalue": "org.matrix.custom.html",
|
|
},
|
|
{
|
|
"keytitle": "formatted_body",
|
|
"keyvalue": {
|
|
"resolved": "message_body",
|
|
},
|
|
},
|
|
|
|
]
|
|
|
|
method = "PUT"
|
|
|
|
path = [
|
|
"https://loxthelion.com/_matrix/client/v3/rooms/",
|
|
{"resolved": "room_id"},
|
|
"/send/m.room.message/",
|
|
{"resolved": "message_id"},
|
|
"?user_id=",
|
|
{"resolved": "matrixuser"},
|
|
"&ts=",
|
|
{"resolved": "timestamp"},
|
|
"000"
|
|
]
|
|
|
|
headers = {
|
|
"Authorization": {
|
|
"os": "AS_TOKEN",
|
|
"prefix": "Bearer ",
|
|
},
|
|
"Content-Type": "application/json",
|
|
}
|
|
|
|
#outputs = {
|
|
# "room_id": "room_id",
|
|
#}
|