Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we receive live direct chat requests ? #49

Closed
jafferkazmi572 opened this issue Jul 21, 2020 · 5 comments
Closed

Can we receive live direct chat requests ? #49

jafferkazmi572 opened this issue Jul 21, 2020 · 5 comments

Comments

@jafferkazmi572
Copy link

jafferkazmi572 commented Jul 21, 2020

Hey Every one, i am building a chat bot service and want to get direct chat requests and approve them so that i can receive messages smoothly ? is there any way ?

What i know is that, direct requests can be get using ig.feed.directPending().items()
@Nerixyz @TheNeKochan

@Nerixyz
Copy link
Owner

Nerixyz commented Jul 21, 2020

I'm not sure whether you'll receive message events using the realtime client on pending threads, but on accepted threads you'll want to look into the RealtimeClient. Now for pending threads, you can expect a notification, so fbns might be helpful here.

so that i can receive messages smoothly

I don't know what "smoothly" is in this context. You either get the message using the HTTP Api or the RealtimeClient.

@jafferkazmi572
Copy link
Author

No, I am only receiving messages from RealtimeClient for which threads are already accepted. But if i receive a message from a user first time , i have to first accept request from Instagram then i start receiving messages from that thread.

That's why i ask how can i get real time direct messages requests like real time messages and smoothly means here real time nothing else.

Anyway thanks for response and for fbns suggestion and it will be a great help if you just tell me what should i look in fbns for pending threads

@Androz2091
Copy link

@jafferkazmi572 You can use FBNS. When someone will send you a DM it will emit the following payload:

super_user_root_2 is the user. THREAD_ID is the ID of the thread. USER_ID is the id of super_user_root_2 and MY_USER_ID is the user id of the bot using instagram_mqtt.

{
	message: 'super_user_root_2 wants to send you a message.',
	igAction: 'direct_v2?id=THREAD_ID&t=p',
	actionPath: 'direct_v2',
	actionParams: [Object: null prototype] {
		id: 'THREAD_ID',
		t: 'p'
	},
	collapseKey: 'direct_v2_message',
	optionalAvatarUrl: 'XXXXXXXXXX',
	sound: 'default',
	pushId: 'XXXXXXXXXX',
	pushCategory: 'direct_v2_pending',
	intendedRecipientUserId: MY_USER_ID,
	sourceUserId: 'USER_ID',
	badgeCount: {}
}

@Androz2091
Copy link

Androz2091/insta.js@af89d78 could help you.

@jafferkazmi572
Copy link
Author

yeah thanks @Androz2091 , i have used fbns and it solved my problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants