Twitter API, reply tweets become unavailable - node.js

I am trying to post a thread on Twitter through my bot with nodejs. I can successfully post the tweets subsequently by replying to them and create a thread. I use npm twitter package.
I am checking from an external account if tweets are all ok. In the first few seconds it's all good. But when I refresh in less then a minute all tweets above and below a tweet become 'unavailable'. If I log in to the bot account I see tweets are available and connected to each other.
This is how it looks in the website
At first tweets are fine. But if I click it a minute later all tweets look like this
From the bot account, it's all fine
My reply function is as follows:
function reply(status, prevIdStr, username) {
return Twitter.post('statuses/update', { status: status, in_reply_to_status_id: prevIdStr, auto_populate_reply_metadata: true });
}
I also check if anything changes by comparing Tweet objects before and after. I really can't find a reason why this should be the case. Has anyone an idea why? Thanks.

I have no idea why, I ended up opening a new account. It started working
Edit: The reason it worked is that the previous account got marked as spam, because I was testing and excessively tweeting.
Creating a fresh account obviously solves the issue, or contact support to lift you suspension.
Edit 2: With a new account and without posting test tweets I encountered the same issue.... Still investigating.

Related

Discord bot read all messages received when offline

I'm creating a discord bot that I would host with my PC so only some hours per day and I'm searching something that allows the bot to read all dms that he received while offline or similar.
I had two ideas to do this.
The first and simpler
call an iphotetic function that collect all the messages that the bot received when it was offline
The second
save the date when the bot goes offline
when it goes back online take all the 'open' private chats (so the ones that contains at least one message)
parse all the messages received from when it went offline to when it came back online
Right now I couldn't find anything on how to do this, any ideas?
Discord seems to have some nice looking api docs that are 100% covered by the discord.py library. I'd dig around there for a bit and see if you can achieve what you are looking for with it. Something as simple as a text file would work to store persistent data, maybe a timestamp or the last message id before the user logged off.
Both your ideas seem decent to me, I'd say just try building them and see if you run into any road blocks. By the time you do you will have a better understanding of the capabilities and limitations of the api and will be able to create a better plan.

Telegram bots not working for all users

I have created several Telegram bots. They work for my account and also on several other accounts that I have tested with.
But I get reports from several users saying the bots never respond.
It there some user setting that would prevent an account from getting messages from bots? Or any other idea why it would not work for some accounts?
Okay, found the issue, it was pebcak.
This issue was it was failing for users that had no last name set in their account because our code was accessing the last_name from the json data.
So make sure your code does not rely on a first or last name.
But I get reports from several users saying the bots never respond.
This is very unusable information. In default all users are equal for the bot usage and no difference between any users if you don't implement it programmatically. But if they says so then try send the POST query to those users in Postman for example and take a look in response. After this it must be clear what kind of problem there.
An example of POST:
https://api.telegram.org/bot{your_bot_token}/sendMessage?chat_id={user_chat_id}&text=test
Note that chat_id those users required.

Instagram search user api always return empty result with success code

We are invoking instagram search users api to get profile list as
https://api.instagram.com/v1/users/search?q={search-term}&access_token={access-token}
but we are getting always empty result with success code as
{"meta": {"code": 200}, "data": []}
Our search term would be always instagram username i.e. username portion from https://www.instagram.com/username/
I remember this was working before 2-3 months. Any other are facing similar issue?
Sounds like you already figured out your problem. In case anyone else is having the same problem, here's a short article summarizing how Instagram's Sandbox Mode works.
TL;DR
“Sandbox mode” is the (unintuitively-named) gatekeeper walling off
most of what you want to do. This is the default status for all
clients, that have not undergone the strict submission process. An API
client in sandbox mode has extremely limited permissions. In fact, it
has fewer permissions than an anonymous user viewing public content
because your app basically lives on a tiny desert island in which you
are the only Instagram user and only your past twenty posts exist. So,
for example, the /media/search endpoint will only return the media you
uploaded near a given location, excluding the media from everyone else
or any posts beyond your last twenty.
So your API call is succeeding. It just isn't finding any results because it can only "see" other sanbox users for your client.

Instagram API throwing OAuthAccessTokenException 400 error using client id

I was using the following api to get the latest 3 posts from public accounts to show on the website:
https://api.instagram.com/v1/users/{user-id}/media/recent/?client_id={client-id}&count=3
I had created an app to get the client-id.
However from today, this API has started throwing the following exception:
{
meta: {
error_type: "OAuthAccessTokenException",
code: 400,
error_message: "The access_token provided is invalid."
}
}
Could you please let me know as how to resolve this?
Based on the date, you probably have an older app that got hit by the API migration today, like mine. In short, Instagram decided to make developing for their platform WAY more annoying by requiring all API requests to be authenticated per user, even for data that users shares publicly. So you (like me) will likely be redesigning you app entirely.
To tell, log in to instagram.com/developer and click manage clients; then hit edit next to the set of keys your're trying to use. Up near the top, it will have a section called 'Client Status' -- if yours reads 'Sandbox Mode', fun times ahead! Hopefully you interact with less than 10 users and can stay in sandbox mode, otherwise you'll have to write an essay, film a video, and basically plead to get your permissions back (probably in a few months, when some Instagram intern finally digs his way down to you in the pile of applications). If it reads something eles, you've got another problem altogether and should thank your lucky stars.
In the meantime, I guess I'll get back to sending out dozens of emails to the maintainers of our many, many affiliated Instagram accounts to explain the issue and try to get permissions, so provided we get approved by then, all our social media displays aren't broken during a huge event Saturday. Another option might be to use the OAuth-less json response available here, but that might break terms of service.
I have a solution to this. If you are using the same code I am, which appears likely. I was pulling the last two images using this.
https://api.instagram.com/v1/users/{user-id}/media/recent/?client_id={client-id}&count=3
What I did to get this working is the following.
Login to your Instragram account you are using as the application.
Go to the developer (API) area. https://www.instagram.com/developer/clients/manage/
Manage clients. Make sure your website URL is the same as your valid redirect URL.
Add new Sandbox User. Put in the account of the IG photos you want to reach.
Hit this URL: https://api.instagram.com/oauth/authorize/?client_id=CLIENTID&redirect_uri=REDIRECT_URI&response_type=token where the client ID is the same one you used in your previous app above.
You should get back and access token URL. Copy your access token.
Login as your account that you want the IG photos of. The account you added as a sandbox user and go to developer and approve the Sandbox Invites.
Change your original URL above from https://api.instagram.com/v1/users/{user-id}/media/recent/?client_id={client-id}&count=3 to https://api.instagram.com/v1/users/self/media/recent/?access_token=ACCESS_TOKEN with your access token.
This is the IG API Media endpoint documentation: https://www.instagram.com/developer/endpoints/users/
After that, it all worked for me and while you are in the sandbox, you should be able to pull the last 3 photos or at this point, figure out how to read the JSON to do so.
Has your app been approved after the June 1st Instagram platform changes?
http://developers.instagram.com/post/145262544121/instagram-platform-update-effective-june-1-2016
If you want to retrieve the user media file then try this, It's working for me
https://graph.instagram.com/me/media?fields=id,caption,media_url,media_type&access_token=ACCESS_TOKEN
For some reason the token is no more valid. Request it again.
Possible reasons why a token is no more valid:
changed password
verified the account
logged-in from a different country

Getting onStartChattingMessage to fire in a Kik bot

I have been playing around with the Kik bot framework using Node and have a bot to chat with. I am using the onTextMessage event successfully, but have yet to get the onStartChattingMessage to fire. The docs are not very detailed, any idea when this gets invoked? I thought it would be when I start a new chat with the bot but that doesn't seem to be it. Or I am just holding it wrong. Code is on GitHub at https://github.com/jcapka/otherword/blob/master/server.js
Per https://dev.kik.com/#/docs/messaging#start-chatting this only happen
Under normal circumstances, you will receive this message once
when user that starts chatting with you for the first time.
If you are trying to get it to work but using the original username you have already chatted.
You'd have to make a new account to be able to get the first-time experience and have that StartChattingmessage
As an example I went and messaged your bot and I got this response `

Resources