Plex Webhooks and Webcore


#1

1) Give a description of the problem
i’d like to have notifications when a remote user starts a movie on plex.

2) What is the expected behaviour?
I’ve tried using $args.payload.Player.local is ‘false’ but i keep getting Comparison (dynamic) is (boolean) false = false (1ms)

3) What is happening/not happening?
it should continue with the script.

5) Attach logs after turning logging level to Full

+1ms ╔Received event [Home].execute = *** with a delay of 50ms
+86ms ║RunTime Analysis CS > 24ms > PS > 30ms > PE > 31ms > CE
+88ms ║Runtime (36864 bytes) successfully initialized in 30ms (v0.3.10b.20190514) (86ms)
+89ms ║╔Execution stage started
+96ms ║║Comparison (dynamic) is (boolean) false = false (1ms)
+98ms ║║Condition #8 evaluated false (4ms)
+99ms ║║Condition group #1 evaluated false (state did not change) (6ms)
+101ms ║╚Execution stage complete. (11ms)
+102ms ╚Event processed successfully (102ms)

#2

What does the webhook look like?


#3
{  
   "event": "media.play",
   "user": true,
   "owner": true,
   "Account": {
      "id": 1,
      "thumb": "https://plex.tv/users/1022b120ffbaa/avatar?c=1465525047",
      "title": "elan"
   },
   "Server": {
      "title": "Office",
      "uuid": "54664a3d8acc39983675640ec9ce00b70af9cc36"
   },
   "Player": {
      "local": true,
      "publicAddress": "200.200.200.200",
      "title": "Plex Web (Safari)",
      "uuid": "r6yfkdnfggbh2bdnvkffwbms"
   },
   "Metadata": {
      "librarySectionType": "artist",
      "ratingKey": "1936545",
      "key": "/library/metadata/1936545",
      "parentRatingKey": "1936544",
      "grandparentRatingKey": "1936543",
      "guid": "com.plexapp.agents.plexmusic://gracenote/track/7572499-91016293BE6BF7F1AB2F848F736E74E5/7572500-3CBAE310D4F3E66C285E104A1458B272?lang=en",
      "librarySectionID": 1224,
      "type": "track",
      "title": "Love The One You're With",
      "grandparentKey": "/library/metadata/1936543",
      "parentKey": "/library/metadata/1936544",
      "grandparentTitle": "Stephen Stills",
      "parentTitle": "Stephen Stills",
      "summary": "",
      "index": 1,
      "parentIndex": 1,
      "ratingCount": 6794,
      "thumb": "/library/metadata/1936544/thumb/1432897518",
      "art": "/library/metadata/1936543/art/1485951497",
      "parentThumb": "/library/metadata/1936544/thumb/1432897518",
      "grandparentThumb": "/library/metadata/1936543/thumb/1485951497",
      "grandparentArt": "/library/metadata/1936543/art/1485951497",
      "addedAt": 1000396126,
      "updatedAt": 1432897518
   }
}

#4

#5

Try logging the contents of $args.Player.local


#6

only started playing with this today. How do you log something?


#7

Put {$args.Player.local} in the Message field.


#8

do you need to “store it in messages”?


#9

Not necessary for debugging.


#10

ok…now what? It still doesn’t work with my if statement.


#11

What was the output of the log command?


#12

+251ms ║║Executed virtual command log (1ms)

Nothing else new showed up.


#13

This guy was working on a plex one, though its a bit more complicated than what I want to do.


#14

How are you triggering the piston?


#15

A link that plex uses everytime some event happens.


#16

Let’s see the link, remove any private keys/tokens…


#17

https://graph-na02-useast1.api.smartthings.com/api/token****/smartapps/installations//execute/:


#18

What’s output of logging {$args.payload.Player.local}


#19

Can you share the piston thats being triggered?


#20
+1ms ╔Received event [Home].execute = with a delay of 1225ms
+1125ms ║RunTime Analysis CS > 1020ms > PS > 57ms > PE > 48ms > CE
+1128ms ║Runtime (37037 bytes) successfully initialized in 57ms (v0.3.10b.20190514) (1124ms)
+1129ms ║╔Execution stage started
+1137ms ║║Condition group #1 evaluated true (state did not change) (1ms)
+1140ms ║║Condition group #7 evaluated true (state did not change) (1ms)
+1143ms ║║Cancelling statement #8’s schedules…
+1161ms ║║Executed virtual command log (2ms)
+1165ms ║║Condition group #10 evaluated true (state did not change) (1ms)
+1176ms ║╚Execution stage complete. (47ms)
+1177ms ╚Event processed successfully (1177ms)