This repository is setup to host companion content for the JNUC 2024 session "Asset Recovery in a Remote World". The session covers strategies and technologies for reclaiming distributed assets in a remote work environment, focusing on streamlining the process through automation and integration with various platforms.
Companion article coming soon!
scripts/
identification.py
- Identify and prepare user data for communication.communication.py
- Sending notifications to users via Slack to check their asset(s) status.reclamation.py
- Processing user responses and generate FedEx return labels if necessary.sample_slack_response.json
- Sample JSON file that mimics a response from Slack's interactive components.helpers/
- Helper modules to facilitate intercation with the various API's described below.airtable_client.py
fedex_client.py
jamf_client.py
slack_client.py
- Python 3.6 or higher.
requests
library installed.
You must configure your API credentials prior to use:
Please don't hesitate to use these if you have use cases that extend beyond those mentioned here. They are far more fully-featured than the helper modules I've written! Just be aware that the response format will vary and require a bit of script modification to implement.
- Airtable
- Jamf Pro
- Slack
GET
/v0/appXXXXXXXXXX/Table
Retrieve records from the specified table.
Response
{
"records": [
{
"createdTime": "TIMESTAMP",
"fields": {
"Address": "123 Main St",
"Name": "Main Street",
"Visited": true
},
"id": "record_id"
},
...
]
}
POST
/v0/appXXXXXXXXXX/Table
Create a new record in the table.
Response
{
"records": [
{
"createdTime": "TIMESTAMP",
"fields": {
"Address": "123 Main St",
"Name": "Main Street",
"Visited": true
},
"id": "record_id"
},
...
]
}
POST
/ship/v1/shipments
Generate shipping labels for asset returns.
Response
{
"transactionId": "624deea6-b709-470c-8c39-4b5511281492",
"customerTransactionId": "AnyCo_order123456789",
"output": {
"cancelledTag": true,
"successMessage": "success"
}
}
POST
/track/v1/trackingnumbers
Retrieve shipment status based on tracking numbers.
Response
{
"transactionId": "624deea6-b709-470c-8c39-4b5511281492",
"customerTransactionId": "AnyCo_order123456789",
"output": {
"completeTrackResults": [
{
"trackingNumber": "123456789012",
"trackResults": [
{}
]
}
],
"alerts": "TRACKING.DATA.NOTFOUND - Tracking data unavailable"
}
}
GET
/JSSResource/computers
Retrieve computer data for asset identification.
Response
[
{
"size": 1,
"computer": {
"id": 1,
"name": "string"
}
}
]
GET
/api/v1/computers-inventory-detail/{id}
Return all sections of a computer.
Response
{
"id": "1",
"udid": "123",
"general": { ... },
"diskEncryption": { ... },
"purchasing": { ... },
"applications": [ ... ],
"storage": { ... },
"userAndLocation": { ... },
"configurationProfiles": [ ... ],
"printers": [ ... ],
"services": [ ... ],
"hardware": { ... },
"localUserAccounts": [ ... ],
"certificates": [ ... ],
"attachments": [ ... ],
"plugins": [ ... ],
"packageReceipts": { ... },
"fonts": [ ... ],
"security": { ... },
"operatingSystem": { ... },
"licensedSoftware": [ ... ],
"ibeacons": [ ... ],
"softwareUpdates": [ ... ],
"extensionAttributes": [ ... ],
"contentCaching": { ... },
"groupMemberships": [ ... ]
}
DELETE
/JSSResource/computers/id/{id}
Delete a computer record from Jamf Pro after recovery.
Response
{
"computer": {
"id": "1"
}
}
POST
/chat.postMessage
Send a message to a Slack channel or direct message.
Response
{
"ok": true,
"channel": "C123ABC456",
"ts": "1503435956.000247",
"message": {
"text": "Here's a message for you",
"username": "ecto1",
"bot_id": "B123ABC456",
"attachments": [
{
"text": "This is an attachment",
"id": 1,
"fallback": "This is an attachment's fallback"
}
],
"type": "message",
"subtype": "bot_message",
"ts": "1503435956.000247"
}
}
POST
/chat.update
Update an existing message with new content.
Response
{
"ok": true,
"channel": "C123ABC456",
"ts": "1401383885.000061",
"text": "Updated text you carefully authored",
"message": {
"text": "Updated text you carefully authored",
"user": "U34567890"
}
}
POST
/users.lookupByEmail
Find a user by their email address.
Response
{
"ok": true,
"user": {
"id": "U123ABC456",
"team_id": "T123ABC456",
"name": "john.doe",
"real_name": "John Doe",
"profile": {
"email": "john.doe@example.com"
}
}
}
This project is licensed under the MIT License - see the LICENSE file for details.