justicenation / slashclock

/clock concept as a new Slack app
GNU General Public License v3.0
0 stars 0 forks source link

Account and contact info pulled from Slack #54

Open martyychang opened 6 years ago

martyychang commented 6 years ago

When new accounts and contacts are created in Salesforce as a result of slashClock being installed and used in a new Slack workspace, Salesforce should poll Slack to pull down key information for the account or contact so as to facilitate communications from slashClock representatives with end users. For example, if feedback is received (see #45) that warrants follow-up, without contact info there'd be no way for a slashClock rep to make contact with the end user.

At a minimum, the following Account fields should be populated.

The following Contact fields should be populated.

martyychang commented 6 years ago

Looking at the current docs on the team.info call, the data element to map to Account Name would be team.name.

{
    "ok": true,
    "team": {
        "id": "T12345",
        "name": "My Team",
        "domain": "example",
        "email_domain": "example.com",
        "icon": {
            "image_34": "https://...",
            "image_44": "https://...",
            "image_68": "https://...",
            "image_88": "https://...",
            "image_102": "https://...",
            "image_132": "https://...",
            "image_default": true
        },
        "enterprise_id": "E1234A12AB",
        "enterprise_name": "Umbrella Corporation"
    }
}
martyychang commented 6 years ago

As for the docs on the users.info call, the fields to map are as follows.

Salesforce Contact Field Slack User Field
First Name First word obtained from splitting user.real_name by whitespace, or null if splitting user.real_name results in only a single word
Last Name All remaining words after the first word obtained from splitting user.real_name by whitespace, or the lone word if the split results in only a single word
Email user.profile.email

There doesn't seem to be any field available to map to the Phone field.

{
    "ok": true,
    "user": {
        "id": "W012A3CDE",
        "team_id": "T012AB3C4",
        "name": "spengler",
        "deleted": false,
        "color": "9f69e7",
        "real_name": "Egon Spengler",
        "tz": "America/Los_Angeles",
        "tz_label": "Pacific Daylight Time",
        "tz_offset": -25200,
        "profile": {
            "avatar_hash": "ge3b51ca72de",
            "status_text": "Print is dead",
            "status_emoji": ":books:",
            "real_name": "Egon Spengler",
            "display_name": "spengler",
            "real_name_normalized": "Egon Spengler",
            "display_name_normalized": "spengler",
            "email": "spengler@ghostbusters.example.com",
            "image_24": "https://.../avatar/e3b51ca72dee4ef87916ae2b9240df50.jpg",
            "image_32": "https://.../avatar/e3b51ca72dee4ef87916ae2b9240df50.jpg",
            "image_48": "https://.../avatar/e3b51ca72dee4ef87916ae2b9240df50.jpg",
            "image_72": "https://.../avatar/e3b51ca72dee4ef87916ae2b9240df50.jpg",
            "image_192": "https://.../avatar/e3b51ca72dee4ef87916ae2b9240df50.jpg",
            "image_512": "https://.../avatar/e3b51ca72dee4ef87916ae2b9240df50.jpg",
            "team": "T012AB3C4"
        },
        "is_admin": true,
        "is_owner": false,
        "is_primary_owner": false,
        "is_restricted": false,
        "is_ultra_restricted": false,
        "is_bot": false,
        "updated": 1502138686,
        "is_app_user": false,
        "has_2fa": false
    }
}