Epoch Time, now, in Webhook

Highlighted
Champion Moderator

Epoch Time, now, in Webhook

Hi All -- I've tried looking into some scripting to do this, but it's a bit out of my wheelhouse. I'm basically looking to timestamp a webhook. Using JSON payload is there a formula to calculate the current Epoch time (minus 7 hours if possible, to be in PT).

My trimmed down payload should be something like this (which works -- I'd just rather it be a token or script or embedded function instead of the static #)

payload={ "attachments": [ { "ts": 1506456000 } ] }

note: I can use this as a my.token if needed -- I already have a workaround for that.

3 REPLIES 3
Highlighted
Level 10 - Community Moderator

Re: Epoch Time, now, in Webhook

There's nothing that's going to represent the current time in JSON: JSON doesn't even support Date objects, only date-like strings and date-like numbers (which have no meaning unless the app at the other end considers them as dates).

The only way you'd be able to go from a Date object or ISO Date string  → Epoch Date number is by using another webhook to generate that value.

Highlighted
Champion Moderator

Re: Epoch Time, now, in Webhook

Know of a webhook to start from? I haven’t found any in my sporadic research.. 😞

Highlighted
Level 10 - Community Moderator

Re: Epoch Time, now, in Webhook

You're sort of entrapping me into breaking forum rules but if you DM me I'll tell you...