Post Your Self

Hello Dearest readers

Its your chance to get your news, articles, reviews on board, just use the link: PYS

Thanks and Regards

Tuesday, January 21, 2020

Top 3 for the day

Top 3 for the day

How to Send Customized Messages to Slack From your App

Posted: 20 Jan 2020 07:43 AM PST

Slack is a popular messaging app used by many teams. It comes with a lot of services and an API for developers to integrate it with their applications. In today’s post we’ll see how to use one of its services called Incoming Webhooks, to send data to slack from an external application.

This way we can easily send messages to Slack from any application we already have; we can send reports, updates, news, notifications and more. For this post, I’ve used JavaScript in the example. To begin, sign into your team’s Slack account.

10 Productivity Tools to Do More with Slack

10 Productivity Tools to Do More with Slack

Since its launch in 2013, Slack has grown to become a top team communication tool. Its availability across... Read more

1. Set up the Integration

You’ll first have to set up an incoming webhook integration. Go to and click on Incoming Webhooks, then select a channel or user you want to post your messages to (this selection can be overridden later in code).

Once done, you’ll see your incoming webhook integration’s configuration page.

Scroll down and there’ll be a Webhook URL in the format Save that URL somewhere, we’ll need it later. You can further change the icon and name of the integration in this page itself, but we’ll do that in code.

2. Create the Message

Let’s imagine you’ve already created a web app that seeks out Valentine’s Day sales in popular sites as well as the offer codes for use during the sale, and for some reason, you want to share this result with your Slack team members.

All we have to do now is to use the webhook URL created in the previous step and post a request to it from your application with JSON data, which will concoct the sale offer message.

Let’s first put together the JSON string that’ll be turned into the Slack message. The parameter carrying the JSON data is called payload, hence the JSON string should look like this:

var myJSONStr = 'payload= {"username": "SALE BOT", "icon_url": "", "channel": "#general"}'  

icon_url is the URL to the image that’ll show up as the profile picture, you can also use icon_emoji to display an emoji as the profile picture instead, for example "icon_emoji": ":gift:". "channel" specifies the channel or username who’ll see your message. For username use the syntax "@username", for channel "#channelname".

Now for the actual message; you can either add the "text" property and write your message as its value and be done with it, or use the property called "attachment" to add richly formatted text, which is what we’ll be doing now.

The "attachment" property of payload goes like this:

"attachments": [{      "fallback": "The attachement isn't supported.",      "title": "VALENTINE'S DAY OFFER",      "color": "#9C1A22",      "pretext": "Today's list of awesome offers picked for you",      "author_name": "Preethi",      "author_link": "",      "author_icon": "",      "mrkdwn_in": ["text","fields"],      "text": "Just click the site names and start buying. Get *extra reduction with the offer code*, if provided.",      "thumb_url": ""  }]

"fallback" is the alternative text to be shown when the Slack message is viewed in an application that doesn’t support message attachment (like in mobile notifications).

"color" is the left border color of the message.

"pretext" is the text that’s shown before the main content.

"author_link" is the URL hyperlinked in author’s name (if provided).

"mrkdwn_in" is an array of property names whose values are shown formatted in the message — based on markdown syntax like (*) for bold and (_) for italics. The three possible values for "mrkdwn_in" are "text", "pretext" and "fields"

"thumb_url" is the thumbnail image’s URL.

Here’s how the message will look like so far.

Now let’s add the fields to the attachment array, which will display the sites and offer codes in two columns.

"fields": [{      "title": "Sites",       "value": "_<|Amazon>_\n_<|Ebay>_",      "short": true  }, {      "title": "Offer Code",      "value": "UI90O22\n-",      "short": true  }],  

Use \n to add line break and the syntax <link|link name> to add hyperlinks.

Underscore is used to format text in italics.

short is set to true if the values are to be displayed side by side (like if it’s short). Put together, the JSONString will look like this (keep the string in a single line in actual working code)

var myJSONStr = 'payload= {      "username": "SALE BOT",      "icon_url": "",      "attachments": [{          "fallback": "This attachement isn't supported.",          "title": "VALENTINE'S DAY OFFER",          "color": "#9C1A22",          "pretext": "Today's list of awesome offers picked for you",          "author_name": "Preethi",          "author_link": "",          "author_icon": "",          "fields": [{              "title": "Sites",              "value": "_<|Amazon>_\n_<|Ebay>_",              "short": true          }, {              "title": "Offer Code",              "value": "UI90O22\n-",              "short": true          }],          "mrkdwn_in": ["text", "fields"],          "text": "Just click the site names and start buying. Get *extra reduction with the offer code*, if provided.",          "thumb_url": ""      }]  }';  

3. Post the Request

Now to make the post request in JavaScript, use the function below:

function postMessageToSlack(){      var xmlhttp = new XMLHttpRequest(),          webhook_url = url-you-saved-from-before,          myJSONStr= json-string-from-above;'POST', webhook_url, false);      xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');      xmlhttp.send(myJSONStr);  }  

Add this function to a button click or page load to see it working.

The final output will look something like this:

incoming webhook

The post How to Send Customized Messages to Slack From your App appeared first on Hongkiat.

5 Free Android Apps to Monitor Your Kids’ Smartphones Activities

Posted: 20 Jan 2020 05:13 AM PST

Google Play Store may not have tougher restrictions than those found on Apple’s AppStore so if your kids own an Android device (or have access to your device at their liberty), you might want to set up some parental apps to help you monitor your kid’s online activities on the device.

In this roundup, we are featuring some free Android apps to monitor your kids’ smartphone activities. From allowing restrictions of online sites to the monitoring of their text or call usage, app downloads, location, and other activities, these apps cover most of the important features. Let’s read on to know more.

Top 5 Mobile Apps to Keep Your Kids Safe

Top 5 Mobile Apps to Keep Your Kids Safe

In today’s highly digitalized world, everyone seems to be carrying a smartphone, and that includes kids as well.... Read more

If you are on iOS, check out this post on 5 ways to make your iOS devices more kid-friendly and child-safe, and if you are on Mac, we also have a list of 10 Parental Control Apps you can try out.

1. Kids Place – Parental Control

Kids Place

Kids Place is a comprehensive parental control app. Some of its handy attributes include a customized home screen showcasing approved apps only, the ability to prevent your child from downloading or buying new apps as well as a time feature to specify a schedule for using the smartphone.

On top of that, it’s also capable of blocking incoming calls and disabling all wireless signals. When you install and use the app for the first time, you have to first set a PIN for security purposes.

2. KuuKla Parental Control

KuuKla Parental Control

KuuKla Parental Control App helps you tailor your Android device into one which is suitable for your child. It gives you the opportunity to select the applications that you want to appear for use on the home screen while disabling access to all other applications. It also allows you to define a schedule for using apps and the Internet on the smartphone.

Once you’ve download the app and registered your email address, a PIN code will be sent to the email address provided which can only be used by you to control the device.

3. SecureTeen Parental Control

SecureTeen Parental Control

Worried about your teen being exposed to mature or adult content online? Try SecureTeen Parental Control which can filter out most if not all adult content. SecureTeen allows you to monitor your children’s online activities, applications they download and their location.

If you don’t like an app that’s installed on your child’s phone then SecureTeen allows you to shut it down, even if it’s still installed. SecureTeen can be managed remotely online by logging into the website.

4. Screen Time Parental Control

Screen Time Parental Control

As the name indicates, Screen Time is a helpful app which lets you manage how much ‘screen time’ your kids get. The key features of Screen Time includes blocking different apps according to the time.

For example, you can block only games at bed time but still allow readings apps then choose to block all apps when it’s time for lights out. Screen Time also allows you to set a daily time limit on the apps you want to restrict access to.

5. Kids Zone Parental Controls

Kids Zone Parental Controls

Kids Zone is another handy parental control app. The chore mode gives you the capability to set a time limit that determines when your child can use the smartphone.

Other notable features include relocking the device after rebooting, blocking phone calls as well as text messages and Internet access, blocking apps installation and in-app purchasing, and various other features.

The post 5 Free Android Apps to Monitor Your Kids’ Smartphones Activities appeared first on Hongkiat.

No comments:

Post a Comment

Gameforumer QR Scan

Gameforumer QR Scan
Gameforumer QR Scan