twitter bot with api - api

im writing a bot that replies to a user message instantly. from what i've read their api only allows checking updates every minute or so.
it's there a push feature or a 3rd party service that pushes the new message to my server right away?
i've seen bots that can do this.

Twitter allows white listing of apps. Then you are only limited to something like 20 or 200 thousand requests an hour. You might want to contact them.

You can look at tweebot python micro framework.
A Python library to build twitter bots over tweepy library. It's a very simple
and flexible way to create your own bot.

First apply for Developper Twitter Account.
And setup your app using the official list of librairies. (python, js and many others available)
If you are using JS, you might not want to use Twit because it is only working with v1.1. You might prefer Twitter-api-v2 but be careful as for now, media upload is not available on v2.
I advise you request an Elevated access from your Developer personal space, which is immediate, and will allow you to use v1 functionalities.
Here is a sample for tweeting an image using twitter-api-v2 (using Elevated account with v1)
import { TwitterApi } from 'twitter-api-v2';
import { twitterconf } from './conf.js';
const client = new TwitterApi({
appKey: twitterconf.CONSUMER_KEY,
appSecret: twitterconf.CONSUMER_SECRET,
accessToken: twitterconf.ACCESS_TOKEN_KEY,
accessSecret: twitterconf.ACCESS_TOKEN_SECRET
});
const image = await client.v1.uploadMedia('/path/to/image.png');
const newTweet = await twitterClient.v1.tweet('Hello World!',
{ media_ids: image });

Related

Does the Shopify API have a way to get a list of all installed apps?

Does the Shopify API have a way to get a list of all installed apps?
I want to keep a history of all apps installed on my stores. The only relevant thing I can find in the API docs is about a Webhook to get notified of an 'app/uninstalled' event.
EDIT
An 'app/installed' event would be ideal, if it existed. It would enhance the security of my stores if I could fetch the list of apps that are installed, or be notified when an app is installed or uninstalled.
To address security concerns, I believe that access to this data should be restricted in the same ways that other API endpoints and webhooks are restricted. The store owner would grant permission to an app to allow it access. This would make it as secure as, for example, customer names.
I'm looking for something roughly equivalent to WordPress's get_plugins function, but for Shopify.
Hey you can use this endpoint to fetch all the installed apps https://shopify.dev/api/admin-graphql/2022-01/objects/queryroot#connections
##example request##
appInstallations (first: 5) {
edges {
node {
id,
launchUrl,
app{
title
},
}
}
}
No. You cannot use the API to query a shop about what Apps it has installed. Imagine that. You get to know all those little shop details and do what with them? Would be like giving you permission to uninstall Apps too. You see why that is a problem? Bad enough Apps can perform cross-talk with metafields... Apps would be another level of wrong.

How to integrate wit.ai With my own chatbot application

I would like to create my own web chatbot and i like to integrate my app with wit.ai for natural language classification.I need to know how to integrate wit.ai service(through api call) with my application(any language in backend).i am using C# in front end.I have gone through the integration part Which posted in wit.ai website.But i don't know how to connect it .Could anyone send me a integration details little briefly
I think the short answer is its similar to how you would call any other APIs from your application server components. Wit exposes multiple APIs like message, speech and converse which you can call by passing the Authorization token and other payloads and make use of the API response in your application.
You can use message API if you are only interested in extracting
intent and other atributes of the sententense
Use speech for building voice based application and
Converse if you want to build a little more smarter app. Currently you can only pass text for converse APIs.Hoping they will introduce voice option for this soon.
Now to make things simpler, they have also provided SDKs in various languages like node-wit, pywit etc. So if you want to build your server side logic using on nodejs or python you can use these SDKs. The advantage is that you dont have to manage raw APIs calls and instead it is all managed by SDK. Also, other big advantage is that you can make use of runActions method which encapsulates converse API and make things simpler. If you want to build in nodejs then the messenger example is a good starting point. You can borrow all this logic/concept in your app and replace FB related calls etc with your custom bot. For Python you can look at the below link
https://github.com/wit-ai/pywit/pull/55
Also, you can explore the options like using other frameworks like botkit if you plan to integrate wit with other chatbots like FB messenger or slackbot as these frameworks provide more flexibility and ability to easily switch to different chatbots in future. But they don't seem to properly support the converse API of wit.
You are specifically looking for integration details. Since you are using c# for frontend app, natuarally the best option would be to use c# for backend as well. In which case you will be left with directly calling wit APIs from your backend as I think there are no SDKs in c#. If you want to make use of SDK in node or python etc then you will have to build a rest based backend (for example) which can be invoked from your c# application. I am currently working on a nodejs app and integrating it with wit using node-wit. I can share some code once its ready but i dont know when I will be able to finish it. For bootstrapping my application I have used this node application. If you have some understanding of node then you can look at the /server/controllers logic. Similar to this application I have built a witController which uses runAction to interact with wit and I am calling this from front-end when user submits a message to your bot. The biggest challenge in runAction is to figure-out a way to send back the wit response to your front-end and get follow up response from user. Wit sends the response in Send method as you can see in the node-wit's messanger example.
Hope this helps!

New version import.io cannot create API

I have a number of APIs both authenticated and not authenticated, created in earlier versions of import.io.
With the new Windows app I can't create an API, or at least pick one up. The tutorial shows a whole bunch of options, but I only get "CONFIGURE" and "EXPORT". "Configure" only gives me the option of single URL, bulk extract and URLs from another API. But there is no link to give me the API address.
Similarly, EXPORT only provides "USE IN DATA SET".
I asked their support but got this:
Hi Glenn,
Thank you for reaching out.
As you may noticed, we made some changes to our interface.
We moved the into the Export tab (next to configure) and named it
simple API integration.
Let me know if you have any questions.
Thank you,
But when I replied that I don't have that option, I got no reply.
What am I doing wrong?
Glenn.
Import.io support got back t me after I sent a screen video (http://www.evernote.com/l/AAhMJsy7INVHFauEOGFQBgEgJq2IPRSA6AU/). There's a bug in the new Windows desktop app that prevents authenticated APIs from showing.

How can I access track/album art from local music from the Spotify API?

I am in the process of building an app using the Spotify API as a learning project for myself.
The purpose of the app is to provide a web based remote control for Spotify so I can control a running instance of Spotify on my desktop using a phone or tablet. The Spotify app talks to my Python web server using websockets so I've gotten the core remote control functionality working fine, but I am running into a separate issue.
In the Spotify app, when it encounters a local file (player.track.local = true), player.track.image returns an empty string. When playing a Spotify hosted track, player.track.image always returns a URI in the form of "spotify:image:...". I know that the Spotify Desktop app can see the album art because it displays in the player on the bottom left. I just can't access it for use in my app.
Is there any way to retrieve this art (or failing that a path to the local file so I can go get it myself from the Python server?) Thanks.
-Jeremy
I figured that was the case.
Since I was running into other issues with the new API (such as no longer allowing access to now playing info) i decided to stick with the old API and I was able to make it work from there. I took advantage of the fact that playlists generate a cover image from their contents, so I just did the following:
(I updated this to reflect some simplification I did after spending some time learning more about arrays today)
function getLocalArt() {
sp.core.library.createPlaylist("tempPL");
var mosaicURI;
var trackURI = player.track.uri;
sp.core.library.getPlaylistsUri().forEach(function (p) {
if (p.name == "tempPL") {
p.add(trackURI);
mosaicURI = p.cover;
sp.core.library.removePlaylist(p.uri);
}
});
return mosaicURI;
}
This works rather well for my purposes and returns a string that looks like this:
spotify:mosaic:localfileimage%3AZ%253A%255CiTunes%255CiTunes%2520Media%255CMusic%255CBroken%2520Social%2520Scene%255CEarCande.com%255CAll%2520To%2520All%2520(Skeet%2520Skeet%2520Remix).mp3
This has a side benefit of providing me with the full path to the track in the file system, which I can pass to my server so I can use that to extract album art for display in my web remote. I understand that the use of sp.core is verboten for apps being distributed to the public, but it works for my little project. Thanks.
In short: no - local files' album art is not stored in the backend and the client doesn't expose local data.

Do any Google Voice APIs still work?

I am interested in writing a simple CLI program that will send an SMS using Google Voice.
There are several scripts and an API or two available, but I have run into an issue that none of them seem to work any longer; as they mostly rely on parsing returned web pages.
Is anyone familiar with a current API that works so that I can send an SMS on Google Voice?
Thanks!
Looks like Google Voice changed the login procedure, and it now expects you to pass back a cookie. This issue for the Python wrapper sums it up: http://code.google.com/p/pygooglevoice/issues/detail?id=60
UPDATE AND FIX: Actually all that needs to happen is to change the login URL in your code:
Old URL - https://www.google.com/accounts/ServiceLoginAuth?service=grandcentral
New URL - https://accounts.google.com/ServiceLogin?service=grandcentral