Can slack webhooks mention multiple users in a single webhook request? - webhooks

As title says, I'm looking to send a single request to a web-hook to mention multiple users. At the moment, from testing I can only seem to get it to mention one and any more results in it either converting the entire body to a string or simply mentioning one.
curl --header "Content-Type: application/json" \
--request POST \
--data '{"incoming":"user#email.com"}' \
https://hooks.slack.com/workflows/ID
This is the call I'm making to the workflow Webhook URL & I was trying to use the user's email as an indetifier. It works for the first but not for any others.
Any info is greatly appreciated, I know I'm doing something dumb here!

I managed to resolve this myself the bad way.
I simply added additional values that I can fill in as needed. It's messy, but however I believe the best way to do this based on the limited permissions and the available functionality of Workflows.

Related

How can I delete a record from a custom grid / table using the REST API?

I don't see any examples in the Acumatica help or in the training on how to actually remove / delete a record from a custom screen / table using the REST (Contract-based) API. How would one go about doing this? Is it a PUT with different syntax? I did see a Stack Overflow case on deleting detail records - I tried this method and it didn't work for me.
Acumatica REST API - Delete SalesOrderDetail
That also refers to a header/detail setup, which I don't have (only grid details). Any help would be appreciated. Thanks...
You can simply send a DELETE request with the id or the key of your record. That will result in the deletion of the specified record.
curl --location --request DELETE 'https://ACUMATICA_URL/entity/Default/20.200.001/ShippingBox/d9ec53fa-b454-4cf0-b398-817b3b1a84aa'
curl --location --request DELETE
'http://<Base endpoint URL>/entity/Default/20.200.001/ShippingBox/TEST'
You can find more information at the following links:
Remove a Record by Key Fields
Remove a Record by ID

How do I authenticate when testing a GET to Webhooks

I am using Zapier Webhooks with Airtable with the intention that when there is a new record in my Airtable, I can take action with the webhook!
However, I am having trouble setting up the API on Zapier.
Here is where I am getting the error: And I think it's because I am not authorizing properly, because afterwards it says:
I know my values are correct because when I make a CURL request, I use the following:
curl "https://api.airtable.com/v0/appyRAw7MAgenvkqu/RTS" \
-H "Authorization: Bearer MY_KEY_HERE | json_pp
And I am returned with proper JSON... but through Zapier, I cannot get past this step.
David here, from the Zapier Platform team.
I did a little digging here and it turns out there's a bug on Airtable's end (which has now been reported) where the User-Agent: Zapier header (which we send by default) causes API calls to 404. There are two solutions:
Overwrite the User-Agent header with anything else
Use the table id instead of the table name in the url
I've tested each and found that it works as expected. Here's a picture of my successful setup:
Sorry about that confusion. ​Let me know if you've got any other questions!

How to get same track/song from Spotify on Apple Music and vice versa?

I'm building a simple app, where users can share the song they're listening with friends. If the user is a Spotify subscriber and his/her friend is an Apple Music subscriber, and the Spotify user is sharing the song,
how can I search for the same song in apple catalog? Is there any common ID, like ISRC on Apple Music? Or any other comparison method?
I know how to use search already for songs/albums etc. The question is how to make sure that the result is the same song from spotify. Any ideas?
Thank you!
The ISRC code is certainly the trick here. Here's how to search in either direction:
Spotify to Apple Music
curl -g -X "GET" "https://api.music.apple.com/v1/catalog/us/songs?filter[isrc]=ISRC" -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer DEVELOPER_TOKEN"
Apple Music to Spotify
curl -X "GET" "https://api.spotify.com/v1/search?q=isrc:ISRC&type=track" -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer OAUTH_TOKEN"
I wrote more about this on my Medium. Good luck!
Song model for MusicKit does not have ISRC according to the documentation. iTunes EPF has ISRC info, but this is not a part of MusicKit API.
I did something similar with one of my projects, so hopefully it can get you on the right track. In short, you can use the iTunes API alongside the Spotify API to search for the same results.
An example in Python.
Get the current playing song/artist with the Spotify API. Search through the response for the information you want, in my case, it was the artist name and album name.
results = sp.currently_playing()
artist = results["item"]["album"]["artists"][0]["name"]
album = results["item"]["album"]["name"]
Look it up with the iTunes API.
i_artist = itunes.search_album(album, artist)[0]
You'll have to learn how the API's work. With iTunes, a search results in a list of results. I'm taking my chances and just grabbing the first one (the most popular). But you can certainly filter through them to make sure it matches what you want. You'll obviously run into things like artists having the same album titles, or even sharing the same name.
It looks like your target platform is iOS, but my code should be a starting point. It's just a matter of saving the information from one platform into variables, and the searching then next one with them.
Hopefully I understood your question correctly, I can expand or provide more code if needed.

How Instagram Real Time Subscription works

I am following this link Instagram Real time updates tag - getting empty data, why? to implement Instagram Real Time Subscription.
I am thinking do I need to hit the url every time in order to check the new update, how is gonna work?. Some are using nodejs, socketio,etc, which I dont want to get into this.
What I am trying to achieve through this that every time is a new update, It starts getting analytic automatically without letting my system know which image to mointor.(I already implemented this part), but stuck on the real time.
Any suggestion to that.
You don't need socketio.
https://instagram.com/developer/realtime/?hl=en
You subscribe to something passing an url that will be used for answers
Everytime there is an update instagram will send you a payload to the url you passed during your subscription.
The point of subscription: You create a subscription (you'll give some parameters, client_id, client_secret and the url you want instagram to call when there is an update, check the documentation for details).
curl -F 'client_id=CLIENT-ID' \
-F 'client_secret=CLIENT-SECRET' \
-F 'object=user' \
-F 'aspect=media' \
-F 'verify_token=myVerifyToken' \
-F 'callback_url=http://YOUR-CALLBACK/URL' \
https://api.instagram.com/v1/subscriptions/
Each time the media you subscribed to is updated instagram will send you new data to the urlcallback you provided in the subscription.
I hope it helps you to understand how it works. Read the documentation throghroughly.
you NEED to read the documentation =D From the documentation:
"When someone posts a new photo and it triggers an update of one of your subscriptions, we make a POST request to the callback URL that you defined in the subscription".

Can I use Auto-away with just a Nest Protect, so no Thermostat? (NEST-API)

I'm trying to request the home/away/auto-away status of my NEST Protect (Smoke+CM) wired version by using the NEST API with a REST call like this:
curl -L -X GET -H "Accept: application/json" "https://developer-api.nest.com/structures/Zwdy.../away?auth=c.uR..."
(where "Zwdy..." is my structure id. Note that I shortend the structure id and the auth code for clarity)
It returns "home" so that seems to work fine! Except that it always returns "home" even if I haven't been in the room for a day or so. Note that I only own a Protect, so no thermostat!
Any hints on what I might be doing wrong?
I did some research and it appears it should be possible to use home/away/auto-away with just the Protect. Or is this incorrect?
Thanks!
Auto-Away works by having the devices in the house vote on the the occupancy status, since the Nest Protect does not maintain a real time connection to Nest's service, it can't participate in or initiate the voting. The Protect will upload historical motion data to the cloud every day, to be used in Auto-Away voting in the future.
Thus, there is no concept of an Auto-Away state in a Nest Protect only household.

Resources