Line messaging API get bot profile issue - bots

As per the LINE messaging API docs,there is API for getting user profile information. When I using that API,
curl -X GET \
-H 'Authorization: Bearer cEet0ordwd4VsUHi9jnbQuWIY+fL5RKeSGP65HEbGtGznHQ4XOaOwaTDQqwLT0bI24oFKLtMvspYvPgi4qR3Bv1oMQp+Wak2x7TRSxsL/oqQN1kIzGTk9aK4ICxU6qK4tM0KHoAkjA1ahEJSswdB04t89/1O/w1cDnyilFU=' \
https://api.line.me/v2/profile
I'm getting the following response:
{"message":null}. How can I get the bot profile information?

You will need to fulfill this conditions:
1. They have to use the latest LINE version.
2. They have to add the bot as their friend.

Related

User signup feathers-authentication with passport-facebook-token

I am trying to allow users to sign up for my service via "login with facebook".
I have already done arrow 1-2. I need to do arrows 3-6. I have made a minimal Feathersjs example at https://github.com/morenoh149/feathers-chat-facebook-signup-api
I seem to be having trouble getting feathers-authentication and passport-facebook-token to generate the User object and sign them up. I've reviewed passport-facebook-token carefully. This answer explains that in the callback to passport-facebook-token you should create the User object. How do I do this with feathers-authentication?
When I provide the token in the body
curl localhost:3030/authentication \
--data-binary '{\
"strategy": "facebook-token", \
"access_token": "<phone token>" \
}'
I get
{"name":"NotAuthenticated",
"message":"You should provide access_token","code":401,
"className":"not-authenticated",
"data":{"message":"You should provide access_token"}
when I pass the token as a header
curl localhost:3030/authentication \
-X POST \
-H "Authorization: Bearer <access token>"
I get error
{"name":"GeneralError",
"message":"Cannot read property 'toLowerCase' of undefined",
"code":500,"className":"general-error","data":{},"errors":{}}
So I downloaded and ran the repo, I used VSCode to run the app and set break points. I created a breakpoint in the before create hooks on users.
The issue here is that the gravatar hook is expected the email to be context.data but it is in fact embedded within the facebook response. You will need to look at extracting the email from that data so that you can create a gravatar or just remove the gravatar hook altogether.

Activating Google Speech API in Firebase CLI?

I get this error when I try to use Google Speech from either the cmd command line (Windows 10) using curl or from a local Firebase server.
"Cloud Speech API has not been used in project firebase-cli before or
it is disabled. Enable it by visiting
https://console.developers.google.com/apis/api/speech.googleapis.com/overview?project=firebase-cli
then retry"
Going to the suggested URL just gives the message:
The API "speech.googleapis.com" doesn't exist or you don't have permission to access it
The curl command has worked before. Login seems to work (using Bearer header). I have no idea why it does not work now. Did I do something before that made it work? Or is there some change to Firebase CLI/Google Speech?
EDIT: Here is the curl command that worked before. I do not think it matters here, but someone might be interested still:
#for /f %%i in ('gcloud auth application-default print-access-token') do #set bearer=%%i
curl -X POST ^
-H "Authorization: Bearer %bearer%" ^
-H "Content-Type: application/json; charset=utf-8" ^
--data #request-flac.json ^
"https://speech.googleapis.com/v1/speech:longrunningrecognize"
Follow the Cloud Speech API quickstart. There is a button that will help you enable the API in your project. If you don't want to do it that way:
Go to the GCP console
Select the APIs and Services option in the left menu
Select dashboard
Click Enable APIs and Services
Type "speech" in the search box
Click the "Speech API" card
Click Enable
This is the generalized way to enable APIs in your project.

Get programmingLanguage and topic for Github repo via API

How can I get the repo-language and topic for a Github Repo through the REST API. I looked at the documentation under - https://developer.github.com/v3/ , but could not get an answer.
Just found one way to do the search for topics as follows. Of course it needs a custom media type at moment.
From the documentation:
curl -H "Authentication: token TOKEN" \
-H "Accept: application/vnd.github.mercy-preview+json" \
https://api.github.com/search/repositories?q=topic:ruby+topic:rails
For the language, it is simply the URL like :
https://api.github.com/repos/postgres/pgadmin4/languages

401 Unauthorized when trying to grab playlists using Spotify API

I've pulled a client_credentials token and while I can access other parts of the API, I can't seem to pull playlist information. It's definitely a public playlist, yet I'm getting 401 Unauthorized. Am I just misunderstanding something?
Edit
For example, this works:
puts curl -I -s -X GET "https://api.spotify.com/v1/users/#{testUser}" -H "Authorization: Bearer {#{#accessToken}}"
This does not:
puts curl -I -s -X GET "https://api.spotify.com/v1/users/#{testUser}/playlists/#{testPlaylist}?fields=href,name,owner(!href,external_urls),tracks.items(added_by.id,track(name,href,album(name,href)))" -H "Authorization: Bearer {#{#accessToken}}"
Are you sure you are sending the credentials cookie as part of your request? If you're not sure, you can use Wireshark or a similar tool to see the details of your request.
Edit: Relevant doc, but you've probably already seen this:
https://developer.spotify.com/web-api/get-playlist/

Square Connect can't subscribe to webhook notifications

I am following the instructions here on setting up webhook notifications for Square payments. But when I execute the curl statement in step 5 to subscribe to my own merchant's payment notifications, I get the response:
{"type":"bad_request","message":"Request body is not an array of event types"}
The curl statement is
curl -X PUT -H "Authorization: Bearer MY_ACCESS_TOKEN" -d '{"event_types": ["PAYMENT_UPDATED"]}' https://connect.squareup.com/v1/me/webhooks
Did they update the event type names? I can't find any other documentation on webhooks.
Whoops! Thanks for catching this error in the blog post, which I have now corrected. The format of the curl previously shown in step 5 had two errors:
The request body should simply have been the array of desired event types, such as:
["PAYMENT_UPDATED"]
With no JSON object surrounding it. The correct format is also shown in the API documentation.
The request was missing a Content-Type: application/json header. All requests to Connect API endpoints require this header.
The correct request looks like this, with your personal access token substituted where indicated:
curl -X PUT -H "Authorization: Bearer PERSONAL_ACCESS_TOKEN" -H "Content-Type: application/json" -d "[\"PAYMENT_UPDATED\"]" https://connect.squareup.com/v1/me/webhooks

Resources