Test Slack team_join event with Postman - postman

I've followed this Slack tutorial to create an onboarding bot that gives people a few tips on how to interaction with other members. The tutorial recommends using Postman to test onboard experience, but it's not clear on how. I'm getting stuck on this: where do I put the a authorization token?
Prereqs:
ngrok is running on port 9292
rackup was run to start the server
I followed all steps to configure the Slack app as shown in the tutorial
I clicked the Slack button to authorize the application
What I'm doing:
Using Postman macOS client to send this default JSON event for team_join to the /events endpoint:
{
"type": "team_join",
"user": {
"id": "U023BECGF",
"name": "bobby",
"deleted": false,
"color": "9f69e7",
"profile": {
"first_name": "Bobby",
"last_name": "Tables",
"real_name": "Bobby Tables",
"email": "bobby#slack.com"
},
"is_admin": true,
"is_owner": true,
"is_primary_owner": true,
"is_restricted": false,
"is_ultra_restricted": false,
"has_2fa": false,
"two_factor_type": "sms"
}
}
I've tried including token as a parameter, header key/value and within the JSON object. None of these approaches seems to do it and it results in an authorization error. I get Invalid Slack verification token received: or a parsing issue.
How does one test something like a new user joining using this setup?

The token is available within the Event envelope, so you'll need to go up one level in the JSON:
{
"token": "{{verification_token}}",
"team_id": "{{team_id}}",
"api_app_id": "{{app_id}}",
"event": {
"type": "team_join",
"user": {
"id": "{{user_id}}",
"team_id": "{{team_id}}",
"name": "{{user_name}}",
"deleted": false,
"status": null,
"real_name": "{{user_real_name}}",
"profile": {
"first_name": "{{user_first_name}}",
"last_name": "{{user_last_name}}",
"real_name": "{{user_real_name}}",
"real_name_normalized": "{{user_real_name}}"
},
"is_bot": false
}
},
"type": "event_callback",
"authed_users": ["{{authed_user}}"]
}

Related

Callback url value in email for verifying account

This is an extension of Unable to validate account confirmation in WSO2 version 6.0 issue.
I have same regex pattern in my self-registration section. But when I'm creating users using rest API, the link which I got in the email is
https://localhost:9443/accountrecoveryendpoint/confirmregistration.do?confirmation=ce790759-1086-4870-a673-35b5927351d8&userstoredomain=PRIMARY&username=samyu&tenantdomain=carbon.super&callback={{callback}}
and when I created the user using manually the link which I got is
https://localhost:9443/accountrecoveryendpoint/confirmregistration.do?confirmation=dff024e7-d7e7-48ef-bb60-1c1c4d6f3b1c&userstoredomain=PRIMARY&username=sam&tenantdomain=carbon.super&callback=https%3A%2F%2Flocalhost%3A9443%2Fmyaccount.
So, the difference between these two links is that callback. So what configuration should I make in order to get the callback value
When you are trying this from the recovery portal, the callback value is set automatically. If you are trying with the REST API you need to include that in the request. The following is a sample JSON payload.
{
"user": {
"username": "kim",
"realm": "PRIMARY",
"password": "Password12!",
"claims": [
{
"uri": "http://wso2.org/claims/givenname",
"value": "kim"
},
{
"uri": "http://wso2.org/claims/emailaddress",
"value": "kimAndie#gmail.com"
},
{
"uri": "http://wso2.org/claims/lastname",
"value": "Anderson"
},
{
"uri": "http://wso2.org/claims/mobile",
"value": "+947729465558"
}
]
},
"properties": [
{
"key": "callback",
"value": "https://localhost:9443/myaccount"
}
]
}
Notice the way how you need to send the callback when using the REST API.

Facebook (Instagram) Graph API not returning instagram_business_account

First of all, let me explain what I have today:
I have a access token with the following permissions: email, public_profile, pages_show_list, pages_read_engagement, instagram_basic, instagram_manage_insights
I have a valid access token
The accounts that I'm trying to access are Business Account or Content Creator account
With that in mind, here's my problem: some users that are connected to my platform simply don't return the instagram_business_account when I'm requesting /me/accounts.
My request is to https://graph.facebook.com/v10.0/me/accounts with the fields id,name,instagram_business_account{id,biography,ig_id,followers_count,follows_count,media_count,name,profile_picture_url,username,website}.
Here's a sample result where both should return the instagram_business_account, because both are connected to Facebook as a Business Account:
{
"data": [
{
"id": "xxxx",
"name": "xxxxx"
},
{
"id": "xxxxx",
"name": "xxxx",
"instagram_business_account": {
"id": "xxxx",
"biography": "xxxx",
"ig_id": 00000,
"followers_count": 0000,
"follows_count": 0000,
"media_count": 0000,
"name": "xxx",
"profile_picture_url": "xxxx",
"username": "xxxx"
}
}
],
"paging": {
"cursors": {
"before": "xxxx",
"after": "xxxx"
}
}
}
Does anybody have any idea what is the problem happening here?
I figured out the problem. This is a Facebook problem, there's nothing we can do. Instagram is connected on Facebook through instagram_business_account. If this value doesn't exist, that means the account is not connected correctly. The user should reconnect the page https://www.facebook.com/{id}/settings/?tab=instagram_management.
The id value is the one from query result. The second alternative is go to Instagram, go to the profile, click on "Edit Profile" and in "Page", just connect to Facebook again.
With that you will be able to get the correct result.

How can I un-spam my domain while testing mailgun webhooks?

I managed to create all that code that creates mailgun webhooks plus many other things like record responses to local database.
During my tests I send emails to yahoo & gmail and of course - as you expected - I pressed a couple of times the spam button at my tablet's yahoo app to test and verify the events recorded with my code.
My problem is that now when I send to that yahoo address from the domain under test the email never reaches my inbox and at the logs I read:
4.7.0 [TSS04] Messages from 159.135.140.82 temporarily deferred due to user complaints - 4.16.55.1; see https://postmaster.verizonmedia.com/error-codes
See what mailgun reports:
{
"severity": "temporary",
"tags": [
"issue 1",
"newsletter",
"2020"
],
"mailing-list": {
"list-id": "xyz101.mail.mysite.com",
"sid": "1634752",
"address": "xyz101#mail.mysite.com"
},
"storage": {
"url": "https://storage.eu.mailgun.net/v3/domains/mail.mysite.com/messages/AgEFucSTB0eaifXAHzlNKbRoSH0IddfpZA==",
"key": "AgEFucSTB0eaifXAHzlNKbRoSH0IddfpZA=="
},
"delivery-status": {
"tls": true,
"mx-host": "mx-eu.mail.am0.yahoodns.net",
"attempt-no": 1,
"description": "",
"session-seconds": 0.39575695991516113,
"retry-seconds": 600,
"code": 421,
"message": "4.7.0 [TSS04] Messages from 159.135.140.82 temporarily deferred due to user complaints - 4.16.55.1; see https://postmaster.verizonmedia.com/error-codes",
"certificate-verified": true
},
"recipient-domain": "yahoo.co.uk",
"id": "D5IqK77PRA29RvULyzXLsw",
"campaigns": [],
"reason": "generic",
"user-variables": {
"id": "15"
},
"flags": {
"is-routed": false,
"is-authenticated": true,
"is-system-test": false,
"is-test-mode": false
},
"log-level": "warn",
"timestamp": 1604915932.781863,
"envelope": {
"transport": "smtp",
"sender": "sales#mail.mysite.com",
"sending-ip": "159.135.140.82",
"targets": "blah-blah-blah#yahoo.co.uk"
},
"message": {
"headers": {
"to": "cent C. <blah-blah-blah#yahoo.co.uk>",
"message-id": "20201109095852.1.8EC4631A16DA1C10#mail.mysite.com",
"from": "mysite <sales#mail.mysite.com>",
"subject": "test_MailGunHttpClient_send_from_real_domain_with_tags_with_tracking_opens_and_clicks_with_unsubscribe_enabled_and_with_recipient_variables_visible_to_webhooks_to_mailing_list_of_access_type_readonly"
},
"attachments": [],
"size": 2130
},
"recipient": "blah-blah-blah#yahoo.co.uk",
"event": "failed"
}
This message eventually will become severity: "permanent".
Any idea how I can reverse this behavior at yahoo servers not accepting my emails(*)?
(*) For another domain I setup at Mailgun I inspect deliverability as I haven't clicked the spam button for emails landed from that domain
Looks like your actions have had some repercussions, emails from one of our accounts using the same IP are blocked by Yahoo, Aol etc. And it started for no reason related to us, the recipients or the content of the emails (it is a paid newsletter).

How can we get the phone number with Google OAuth API and facebook API used for social login?

How can we get the phone number with Google OAuth API login.
I am using scopes as
'scope' : 'https://mail.google.com https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/plus.login '
and the request is as
var request = gapi.client.plus.people.get({'userId': 'me'});
Is there any scope we can use to get it.
I am getting response as with no sight of phone number :
{
"kind": "plus#person",
"etag": "\"vPymIyv1bT9LfmoUujkgN2yLMK0\"",
"gender": "male",
"emails": [
{
"value": "XXX#gmail.com",
"type": "account"
}
],
"urls": [
{
"value": "http://picasaweb.google.com/XXX",
"type": "otherProfile",
"label": "Picasa Web Albums"
}
],
"objectType": "person",
"id": "4354354334435465",
"displayName": "XXXXX YYYY",
"name": {
"familyName": "XXX",
"givenName": "YYYYY"
},
"url": "https://plus.google.com/1100335464643327",
"image": {
"url": "https://lh3.googleusercontent.com/-fgsdgfgU9-jU/AAAAAAAAAAI/AAAAAAAADkM/fgffdgdkM/photo.jpg?sz=50",
"isDefault": false
},
"isPlusUser": true,
"language": "en",
"ageRange": {
"min": 21
},
"circledByCount": 59,
"verified": false
}
if you want to get user phone numbers you have to have authorization from the user: see the following info page : https://developers.google.com/admin-sdk/directory/v1/guides/authorizing
ask the user for this scope of authorization :
https://www.googleapis.com/auth/admin.directory.user.readonly
after you have authorization from user run the folowing request :
GET https://www.googleapis.com/admin/directory/v1/users/userKey
the response will be a JSON response formatted as followed:
https://developers.google.com/admin-sdk/directory/v1/reference/users#resource
one of the attributes is phone list.
hope it helps.
You can use google's people API to get the user's phone numbers.
To explore more you can try yourself.
Steps to explore:
Visit this link.
Select https://www.googleapis.com/auth/user.phonenumbers.read permission in People API v1 section
Click on Authorize API
Choose the account to log in
Grant permission
Click Exchange authorization code for tokens
Enter https://people.googleapis.com/v1/people/138262720636785143353?personFields=phoneNumbers,emailAddresses link, make sure you replace the UID
Click on send request to see the response

Oauth.io only gets "name" and "id" in the raw data from Facebook v2.4 and v2.5

When integrating a Facebook App with oauth.io, the latest API version we can choose is v2.3.
The login process works though, but, when trying to retrieve the user data (/me), only the elements name and id are being delivered in the raw data from the oauth.io response:
curl "https://oauth.io/auth/facebook/me"
-H “oauthio:k=<myOauthKey>&access_token=<fbAccessToken>"
we get following response:
{
"status": "success",
"data":
{
"id": "fbId",
"avatar": "https://graph.facebook.com/v2.3/fbId/picture",
"name": "User Name",
"gender": 1,
"url": "https://www.facebook.com/fbId",
"raw":
{
"name": "User Name",
"id": "fbId"
}
}
}
If we make the call directly using Facebook, I can get extra fields if I specify them in the URL:
curl "https://graph.facebook.com/v2.5/me?access_token=<fbAccessToken>
&fields=name,email,gender,birthday,first_name,last_name,picture"
we get the data we are looking for:
{
"name": "User Name",
"email": "email\u0040email.com",
"gender": "female",
"birthday": "03/02/1994",
"first_name": "User",
"last_name": "Name",
"picture": {
"data": {
"is_silhouette": false,
"url": "https://scontent.xx.fbcdn.net/hprofile-xlt1/v/t1.0-1/p50x50/whatever"
}
},
"id": "fbId"
}
The reason is clear: since v2.4 Facebook requires the fields parameter to retrieve the extra data. See Fewer default fields for faster performance under https://developers.facebook.com/blog/post/2015/07/08/graph-api-v2.4/
Do you know if there is any way to tell oauth.io to fill the fields parameter when calling the facebook /me call?
Btw, using:
https://oauth.io/auth/facebook/me?fields=name,email,gender,birthday
does not work.
Oauth.io has fixed the issue and is available from 1.0.0-beta.18
https://github.com/oauth-io/oauthd/commit/7beec64ab39955c3afd2eb28ecf7288c74ccdc96