*We changed the QR code experience, but changing our Knowledge Base articles to reflect the new platform will take some time. Thanks for your patience.
So you want to try your hand at making a Developer’s Webhook for a TapAction? Great! Since our crew at Phy loves Slack (the collaborative real-time messaging tool for teams), we created this TapAction recipe using a Developer's Webhook to make it possible for smartphone users to initiate posts to Slack from interaction with a QR Code, NFC Tag, or Bluetooth Beacon managed on Phy.
Why would this be useful, you ask? Here are some use cases:
- Guests scan a QR Code in your office lobby to ring your bell through Slack
- When the copier is broken, employees tap the NFC Tag to trigger a help desk message in Slack for that copier
- Individual QR Codes at employee desks can ping Slack with direct messages to the employee
- There's probably something fun to do with the fridge or foosball table too
Included in this recipe are the ingredients needed to recreate this TapAction yourself. When you're done, you'll be able to see the experience shown below...
...which will trigger a post to Slack like this one below.
To create this experience yourself, follow the steps below to create a Payload URL, which uses the Slack API to write a message to a specific channel.
Step 1: Download the favicon and image attached to this article
They’re at the bottom of this page.
Step 2: Sign in to your Slack account
You need a Slack account to use this recipe. Your account is where your Slack posts will appear. If you have one, sign in here.
Step 3: In Slack, create a Slack app
Visit https://api.slack.com/apps, click the green “Create an app” button, and give the app a name (we called ours “d3mo”). Click save.
Step 4: In Slack, create a Bot User
In the sidebar under “Features,” click “Bot Users” to create a bot user. The next screen will populate the name of the app you had just created. Click save.
Step 5: In Slack, install your app
In the sidebar under “Features," click “OAauth & Permissions,” then click the green “Install app to workspace” button. Your Slack team will ask you to confirm your identity. Go ahead and click the “Authorize” button.
Step 6: In Slack, collect your URL parameters
On the next screen, copy your “Bot User OAuth Access Token”. You will need this later as your TOKEN for your Payload URL.
You’ll then need to pick a channel where your app will exist. It can be a public team channel, but if it is a private channel, you will have to invite your Slack bot to the channel. This will be the CHANNEL parameter for your Payload URL.
Now build your message and encode it. You can do this by going to http://pressbin.com/tools/urlencode_urldecode/, entering your text, and copying the text from encodeURIComponent. You will use this for your TEXT in your Payload URL.
Step 7: In Phy, create a Destination in your Library
Use the following parameters:
- Name: Post to Slack
- Destination Type: TapAction
- Action: Developer’s Webhook
- Method: GET
- Payload URL: https://slack.com/api/chat.postMessage?token=TOKEN&channel=CHANNEL&text=TEXT (with TOKEN, CHANNEL, and TEXT replaced with portions found in step 6)
- Success Message: Successfully posted to Slack!
- Loading Message: Posting to Slack…
- Failure Message: Something went wrong!
- CoverCard Meta Title: Tap to post to Slack
- CoverCard Meta Description: When you tap this card, our team will be notified via Slack
- CoverCard Meta Favicon: Favicon_Slack.jpg
- CoverCard Meta Image: Image_Slack Logo.png
Crafted by Kevin Huber, Full Stack Developer/Scrum Master/Occasional Yodeler at Phy
Here are the attachments