2

I am writing a slackbot and it involves scheduling change of status at certain times set.

I found the below API to update status but looks like I need a chron job to look up the time

POST /api/users.profile.set
Host: slack.com
Content-type: application/json; charset=utf-8
Authorization: Bearer xoxp_secret_token
{
    "profile": {
        "status_text": "riding a train",
        "status_emoji": ":mountain_railway:",
        "status_expiration": 0
    }
}

I found a scheduler to schedule messages but the API as such is for scheduling messages.

POST https://slack.com/api/chat.scheduledMessage
Content-type: application/json
Authorization: Bearer xoxb-your-token
{
  "channel": "YOUR_CHANNEL_ID",
  "text": "Hey, team. Don't forget about breakfast catered by John Hughes Bistro today.",
  "post_at": 1551891428,
}

Can someone suggest an event which does not use chron job but schedules this action

leo
  • 103
  • 1
  • 10

1 Answers1

2

The Slack API does not provide a mechanism to schedule actions, other then messages.

So if you need to schedule actions, you need to look to other providers for a solution. Most solutions will be based on CRON, because it is a standard service available on any Unix/Linux machine.

An alternative might be using a web based CRON service. There are many and some even free. Here is one example: https://cron-job.org/en/

Erik Kalkoken
  • 30,467
  • 8
  • 79
  • 114