Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to display times in the recipient's timezone?

Tags:

slack-api

I have a webhook that posts a message to a Slack channel. Is there a way to ensure that times mentioned in the message are shown in the user's local timezone?

like image 319
Dan Ross Avatar asked Jun 12 '16 08:06

Dan Ross


2 Answers

Slack's API allows you to output time in the user's timezone using a special placeholder. See Formatting Dates in the API documentation.

like image 80
Brad Daily Avatar answered Nov 15 '22 07:11

Brad Daily


As per the slack API documentation, the chat.postMessage method returns a JSON with a response like this one here

{
    "ok": true,
    "ts": "1405895017.000506",
    "channel": "C024BE91L",
    "message": {
        ...
    }
}

So, i guess you can parse and get the timestamp and format it according to your need . Here is the link to slack api postMessage API documentation. Just to mention, tsis timestamp in above JSON response.

like image 41
Saurabh Chaturvedi Avatar answered Nov 15 '22 06:11

Saurabh Chaturvedi