I'd like to get all Vimeo's videos from a channel.
I looked to the Vimeo API, created a key for my app but I found no simple method to get all videos with for example the id of the channel...
How to do that ?
Thx.
To get the list of videos in a channel, make an authenticated GET request to https://api.vimeo.com/channels/[channel_id]/videos. The endpoint documentation can be found here: https://developer.vimeo.com/api/reference/channels#GET/channels/{channel_id}/videos
If you don't know the channel_id of a channel, you can substitute the id with the custom url of the channel. For instance, with the Staff Picks channel at https://vimeo.com/channels/staffpicks, make an authenticated GET request to https://api.vimeo.com/channels/staffpicks
That said, it's best practice to use the channel_id instead of the shortcut url name wherever possible. The Staff Picks channel, for example, returns "uri":"/channels/927"
The answer above is correct, but I found myself looking for a solution on how to get the channel id.
There two options(that I found) to get the channel id
If you have access to run js in the browser(like in Puppeteer) - run the following js
vimeo.config.channel.id
and it will return the id of the channel.
Another option is to get it via regex
\"channel\"\:\{\"id\"\:\"(\d*)\"
It's taking the following part from the tag
vimeo.config = _extend((vimeo.config || {}), {"channel":{"id":"164226","url":"\/channels\/fenwn"},"sticky_topnav":{"excluded_pages":["Vimeo\\Controller\\AboutController:main","Vimeo\\Controller\\AboutController:profe
Related
I am trying to send a FCM to multiple users at a time. I can't seem to find a clear answer other than using a topic but i have several conditions which make this quite difficult on my side. Is it at all possible to extract all tokens from a particular document (similar to setting it up as a topic but based on my logic) and pass that array to the Cloud function?
My current code is as follows and it works for a single user (i am only posting the part where the token is extracted):
return admin.firestore().doc('Seller_tokens/tokens/' + brand + '/wc').get().then(usertokensdoc =>{
const sellertokenID = usertokensdoc.get("dXufWMvOTLXUOyj8XNv9NFmsQ4x1");
const payload = {
data:{
title:'FCM - Test',
content: 'FCM - This is a test message,
},
token: sellertokenID
};
for the line:
const sellertokenID = usertokensdoc.get("dXufWMvOTLXUOyj8XNv9NFmsQ4x1");
I do not want to specify a single userid, where the 'userid' is the field in the document . And hence I would like to pass an array, if possible.
As you mentioned and as clarified in the official documentation Send messages to multiple devices, there are only two ways of sending messages to multiple tokens:
Firebase Cloud Messaging provides these two ways to target a message to multiple devices:
Topic messaging, which allows you to send a message to multiple devices that have opted in to a particular topic.
Device group messaging, which allows you to send a message to multiple devices that belong to a group you define.
In addition to this, as mentioned in this other question here, there is no API for you to get all tokens at once, so, you will need to get the individually for usage.
So, to summarize, there is not an automatic way of getting the tokens, but once you get them, I believe using the Device Messaging way would be better for you, since you can define specific groups to receive the FCM, per tokens that you retrieved.
Let me know if the information helped you!
you can retrieve the token documents based on your conditions in cloud function. loop through them, create an array of tokens and pass them to Firebase messaging as below
admin.messaging.sendToDevice(tokens, payload). below url has a very good example.
FCM - Cloud Functions Example
Is there an anonymous ID in Actions on Google with Dialogflow that I can access using DialogFlow in Node.js?
I don't need to know the Google account of who is using the Action, but I do want to have a unique identifier so that the Action can know when they come back.
Google no longer provides one for you. You will have to generate one when a new user interacts with your webhook and store the generated id in their user storage object.
To identify a new user your just check if they already have an id in their user storage object. For generating the id you can use an library like uuid. https://www.npmjs.com/package/uuid
Uuidv4 is probably the one that you need if you just need a unique id for simple identifications
The original idea from Google was to leverage a field called userStorage, but this feature seems to be borked ATM.
userStorage Documentation:
https://developers.google.com/actions/assistant/save-data
Reddit thread regarding issues:
https://www.reddit.com/r/GoogleAssistantDev/comments/d88z7e/userstorage_saga_continued/
Unless something has changed (I haven't checked on userStorage since I've been busy writing a fix around it) you may be out of luck without Account Linking. Feel free to try userStorage and keep me honest as they may have remedied the situation internally.
Alternatively, if all you need is an identifier or session for a single conversation you can leverage the conversationId which will be unique until the conversation ends.
I've found a possible option...
(When working in DialogFlow in Node.js, most code is in a handler and the parameter is usually called conv. The following assumes that it is inside such a handler.)
On every single call, check for an 'existing' id in the session data and the user storage:
var id = conv.data.MyId || conv.user.storage.MyId || '';
if(!id) {
id = /* make a new Id for this user... a GUID or some other unique id */
conv.user.storage.MyId = id;
}
Once I get the Id from storage or make a new one, it is critical to reassign it to conv.data, since conv.user.storage seems to be reliably provided only on the first call!
// IMPORTANT
conv.data.MyId = id;
/* use the Id as needed */
My code looks up the Id in a firebase database to get details from their last visit.
This seems to be working, but may not be reliable.
I need a Twilio expert to answer a question for me if they can. I have an application I'm developing in which we want a user to be able to enter a phone number and call someone with a selected phone number as the caller ID. Trick is that caller ID must be in our account Verified Caller IDs list. Now I have found several examples and tutorials about how to do this using the Twilio SDK, however we're using that on our back-end where all our tokens are stored and Twilio-Client on the front-end. Does anyone know of a way to verify a callerID using the Twilio-Client device on the front-end? Big thanks in advance.
Twilio developer evangelist here.
The Twilio Client JS SDK is mostly concerned with placing calls using WebRTC. It does not include features for calling the regular API, including the verified caller id list.
You could do a couple of things here.
Either, before you place the call, make an ajax request to your own server and make a check there against your verified caller IDs.
Or, when the call is placed and Twilio sends the webhook to your TwiML application, check the caller ID is valid at that point. If it isn't, respond to the webhook with a message using <Say> to tell the caller they are trying to call from an invalid caller ID and then <Hangup/>. If it is valid, then place the outbound call leg with <Dial>.
Let me know if that helps at all.
I found two ways to verify a callerID.
get a list of numbers from your account and loop through them as follows:
https://www.twilio.com/docs/voice/api/outgoing-caller-ids?code-sample=code-list-an-accounts-outgoing-caller-ids&code-language=PHP&code-sdk-version=6.x
$outgoingCallerIds = $twilio->outgoingCallerIds
->read([], 20);
foreach ($outgoingCallerIds as $record) {
print $record->sid.",".$record->phoneNumber.",".$record->friendlyName;
}
attempt the validate the number and watch for an error
https://www.twilio.com/docs/voice/api/outgoing-caller-ids#add-an-outgoing-caller-id
try{
$validation_request = $twilio->validationRequests
->create("+1".$cell, // phoneNumber
["friendlyName" => $name]
);
} catch (Throwable $e){
$pos=(strpos($e,"Phone number is already verified") );
if (is_numeric($pos) ) { do something }
}
SDK
Homepage: https://github.com/Microsoft/BotBuilder
SDK Platform: Node.js
SDK Version: 3.14.0
Issue Description
Hi, I searched for this for a long time now but I haven't found an answer.
I was wondering if there is a way to bind some URL parameters to the User's Bot Session.
For example, if for a specific chat dialog, I set my Endpoint URL to:
http://localhost:3978/api/messages?pronuntiation=british
is there a way to get that url parameter named "pronuntiation" down in the session object like...
bot.dialog("/", function(session){
var desiredPronuntiation = session.someUrlParameters.pronuntiation;
if( desiredPronuntiation == "british"){
///blah
}
});
I think it is possible in C# SDK but I was trying to do this in NodeJS...
I already debugged the proces from the server.post('/api/messages', connector.listen()) down to the ChatConnector.verifyBotFramework() where at the end I found it calls _this.dispatch(req.body, res, next); (ChatbotConnector.js on line 149) passing only the post body but not the request object itself...
So at a first glance I think this is not possible, I just wanted to be sure that I didn't miss anything...
Thanks,
Luis
As far as I know, this isn't supported by the Bot Framework, however I don't see why you need to do it this way. This is something you want to store in the state, for example the userData. You can read more here about managing state in the Bot Framework.
If you want to pass user data to the bot, it depends on the channel. For example Facebook and Webchat allow you to pass data direct to the bot, without user input.
I have created a node/feathers project using this chat application guide as a base. It's working great, but now I would like to filter the results the api is giving. For example, when user makes GET request to /messages I would like the response to include only the messages that the authorized user has created, not anyone else's messages. Auth is working correctly in the api and message items have the userId who created the message, but I just don't understand what and where I'm supposed to do to filter the messages according to the user id. After hours of googling I couldn't find anything related to this or anyone even asking the question, so what am I missing here?
You can do a manual filtering. Both on before and after hooks. How to use hooks.
In before hooks you can create a function that update your query object to only get/find data it owns.
hook.params.query = { ... , ownedBy: hook.params.user._id }
Or do result filtering in after hooks, you have the hook.result which is the only thing you can manipulate in the after hooks. Then you can use Array.prototype.filter() to filter the results the user gets.