---
# System prepended metadata

title: 'Live demo: fun with APIs!'

---

# Live demo: fun with APIs!

## Slack

First create a Slack app and copy the token to:

```sh
% lpass add slack-token
Name: slack-token
URL:◃
Username:◃
Password:◃                # ⚠️ put token here
```

### Away ([users.setPresence](https://api.slack.com/methods/users.setPresence))

Try with "auto", "away"

```sh
curl -s -X POST https://slack.com/api/users.setPresence -H "Authorization: Bearer $(lpass show -p slack-token)" -H 'Content-type: application/json; charset=utf-8' -d @- <<< '{"presence": "auto"}' | jq
```

### Emoji ([users.profile.set](https://api.slack.com/methods/users.profile.set))

Try with ":smiling_imp:", ":innocent:"

```sh
% curl -s -X POST "https://slack.com/api/users.profile.set" -H "Authorization: Bearer xoxp-311490602275-697884265111-795159828884-89c670948099a2c13c090edb2032003e" -H 'Content-type: application/json; charset=utf-8' -d @- <<EOF | jq
{
    "profile": {
        "status_text": "",
        "status_emoji": ":mountain_railway:",
        "status_expiration": 0
    }
}
EOF
```

## Hibob

First, get a token and create a lpass entry `lpass` entry:

```sh
% lpass add hibob
Name: hibob
URL:◃
Username:◃
Password:◃                # ⚠️ put token here
```

### Who is on vacation

```sh
curl -sH "authorization: $(lpass show hibob -p)" https://api.hibob.com/v1/timeoff/outtoday | jq -r '.outs[].employeeDisplayName'
```

### Who is reporting to who?

```sh
curl -sH "authorization: $(lpass show hibob -p)" https://api.hibob.com/v1/people | jq '.employees[] | "\(.displayName)\t-> \(.work.reportsTo.displayName)"' -r | expand -t20
```

### Where is who?

```sh
curl -sH "authorization: $(lpass show hibob -p)" https://api.hibob.com/v1/people | jq -r '.employees[] | "\(.displayName)\t\(.work.site)"' | expand -t20
```

## Clubhouse

First, go to Settings -> API token and put the token in lpass:

```sh
% lpass add lpass
Name: lpass
URL:◃
Username:◃
Password:◃                # ⚠️ put token here
```

### Who is admin or owner?

```sh
curl -s "https://api.clubhouse.io/api/v3/members?token=$(lpass show ch -p)" | jq '.[] | "\(.role)\t\(.profile.name)"' -r | grep '\(admin\|owner\)'
```
