Epoch Time, now, in Webhook | Community
Skip to main content
Community Advisor
September 26, 2017
Question

Epoch Time, now, in Webhook

  • September 26, 2017
  • 1 reply
  • 2280 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

SanfordWhiteman
Level 10
September 26, 2017

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.

JDNelson1Community AdvisorAuthor
Community Advisor
September 26, 2017

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

SanfordWhiteman
Level 10
September 26, 2017

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