Is there a way to start an Instagram direct conversation with a link (just like there is https://wa.me/text to start a whats app conversation)? Or what can I do to do something similar?
Thanks in advance
No. Instagram documents their available URL schemes, and initiating a direct message is not one of the available options at this time. Your best bet will be linking to their user profile; it should only be a click away to initiate a conversation.
<a href="instagram://user?username=USERNAME">
Good news Guys !!
I have found a solution to directly open an Instagram Chat using ADB/Shell command.
So all you need to do is first fire up logcat and click on a notification which has a message for you and check your logcat to find the DATA_URI like the following:
START u0 {dat=ig://direct_v2?id=XXXXXXXX&x=XXXXXXXXXXX&push_category=null&user_id=XXXXXX&calling_package=com.instagram.android&entry_point=push flg=0x4000000 pkg=com.instagram.android cmp=com.instagram.android/com.instagram.mainactivity.MainActivity (has extras)} from uid 10071
and then note the following parameters:
id (This is the recipient id that will be used to select the contact)
user_id [optional](this is the id that is used to mention which account to use)
and then construct the am command as such:
Note: Use --user parameter only when you are using termux and user_id parameter is optional.
For Termux:
$am start -f 0x4000000 -n com.instagram.android/com.instagram.mainactivity.MainActivity --user 10071 -d "ig://direct_v2?id=XXXXXXXX&push_category=null&user_id=XXXXXXXX&calling_package=com.instagram.android&entry_point=push"
For ADB Shell:
$am start -f 0x4000000 -n com.instagram.android/com.instagram.mainactivity.MainActivity -d "ig://direct_v2?id=XXXXXXXX&x=XXXXXXXXXXX&push_category=null&user_id=XXXXXXXX&calling_package=com.instagram.android&entry_point=push"
From what I think, this method is efficient as you might wanna note that the id parameter is obtained by Just opening instagram on a browser and open the chat to specific contact and grab the value after "https://www.instagram.com/direct/t/". And the second thing I noticed is that the user_id parameter is what defines our account's id.
Give this method a shot and let me know if it helped.
You can start a chat using the following link: https://ig.me/m/username
Related
I am using Stripe Checkout to process orders on my site and then save the order once its complete using the webhook Checkout.Session.Complete . It works all well and good but I would like to store the last 4 digits used to process the order. If I send a receipt using Stripe it lists that info so I know its possible, I just prefer to store it and send my own receipt to customize and assist customers if an order is off. The checkout session object doesnt list the last 4 digits for some reason so whats the best way to get that info based on what the session object returns???
The answer will depend on the type of Checkout Session you are working with.
If you are working with Checkout Sessions where mode:payment, then you should expand payment_intent.payment_method when you retrieve the Session. Then, you can check payment_intent.payment_method.card.last4 to get the last 4 digits.
If you are working with Checkout Sessions where mode:subscription, then you should expand subscription.default_payment_method when you retrieve the Session. Then, you can check subscription.default_payment_method.card.last4.
If you're not already familiar with expansion, you can read more about it here (https://stripe.com/docs/expand).
Edit: addressing the first comment below and for clarity, this isn't a code question. The question is simply:
What do I put into the URI querystring of the new Gmail UI to view a draft message created by the Gmail API?
Despite this not really being a code question, I'm asking on Stack Overflow as it's Google's preferred platform for Gmail API questions.
--
If I view a draft message in the new Gmail UI, the URI is something like this:
https://mail.google.com/mail/u/1/?zx=iij9apqgzdf4#drafts?compose=jrjtXSqXwlFGnSGCQgDCdnHGVFdlpFMgzsCNgpQstQLxdLCMkjKstBmWZkCmjhWTQnpsZCJF
I can't see any way to create such a link from the Id or ThreadId of a message created via the Gmail API.
Previously, one could do this:
https://mail.google.com/mail/u/1/?zx=ov61dxfbrcga#drafts?compose=1631caae9dbb074d
where the value of "compose" is the Id.
How can the same thing be accomplished in the new UI?
I've been encountering the same problem and have had some success in this problem, as well as some issues I still can't get past.
Good news: The new compose parameter format is some kind of "base40" encoding. I searched the Gmail source for a restricted alphabet string, and found and deobfuscated the bit of code doing this encoding/decoding: https://gist.github.com/danrouse/52212f0de2fbfe33cfc56583f20ccb74
This code includes an encode and decode function which should work for Gmail-format query parameters.
Bad news: The values that it is encoding to open draft emails do not appear to be available using the Gmail API. Specifically, they look like this:
thread-f:NEW_THREAD_ID+msg-a:DRAFT_ID -- while the draft ID is the same as it was before, the Thread ID does not appear to match any of the IDs that the Gmail API returns.
Interestingly, if you inspect the subject row in the Gmail UI, it has dataset attributes including all of both the old format and new format IDs - but it's still unclear how to get the new ones programatically.
Thanks to #frank-szilinski - he pointed out that the old format is now translated. I.e. this now works again:
https://mail.google.com/mail/ca/u/1/#drafts/1661237c4db71ace
It doesn't seem to work when the Gmail tab isn't already open, however.
Building on #kremonte gist, and #chris-wood comments, I made a rails gem that correctly creates the open-the-draft-inside-gmail URL.
It's here - https://github.com/GoodMeasuresLLC/gmail_compose_encoder
It's for the use case of "my code created a draft (prepopulated with some text, of course) and now I want to open the draft in compose mode so that my user can review it before hitting "send".
How to get the URL for a draft
If, for example you use a list request from which you get your draft objects:
{
"id": string,
"message": {
object (Message)
}
}
You can take this id and put it into a URL in this format:
mail.google.com/mail/#inbox?compose=[id]
Eg.
mail.google.com/mail/#inbox?compose=3doinm3d08932d
This will open up GMail with the relevant draft open.
I was struggling because I wanted it to work with multiple accounts. However the authuser parameter did not help.
Inserting the email address instead of the integer after the u/ component solved the problem.
https://mail.google.com/mail/u/{email_address}/#drafts?compose={message_id}
The message id is the one provided by the API.
I'm creating a bot in DirectLine. I'm trying to use SuggestedActions to display a suggested action and I don't want to include the text attribute for that. When I try to run my code without the text attribute, I see a blank message being displayed. How can I avoid that?
My code
var msg = new builder.Message(session)
.suggestedActions(
builder.SuggestedActions.create(
session, [
builder.CardAction.imBack(session, "disconnect", "Disconnect"),
]
));
session.send(msg);
The Output i'm getting:
Per my understanding, you want a button which is shown absoluted at bottom and always display to remind your agent that he can disconnect conversation any time.
However, per me testing and understanding, in my opinion, there 2 points that it's maybe not a good idea to achieve this feature:
SuggestedAction is based on Messasge in Bot framework. And basically Bot application is for conversation. So every message between user and bot renderred in different channels should always be contained in a textbox, shown like in your capture. We cannot bypass this feature.
Per your requirements, I think you want this button should be always display unless the agent click it. But I didn't find any feature like this in Bot framework, and you may need to send this meesage additionally beside every message from bot, which is not graceful and will raise unpredictable risk.
My suggestion is that you can create a triggerAction to handle global disconnect requests. Refer https://learn.microsoft.com/en-us/bot-framework/nodejs/bot-builder-nodejs-dialog-actions for more info.
I wanted to extract Instagram Follower/Following Data(other user, not my own) and also the names/userid of the Follower/Following. I have searched through the forum but so far what I found is that need authentication before could access any basic data from the Instagram user.
May I know is it possible not to go through the authentication but still able to pull the relationship data (following/follower) data?
What I am trying to achieve here is to track for example do a data analysis of how many followers does a particular public profile of a instagram user has (i.e. maybe some newly opened toy shop that has started a instagram profile). Authenticating each and every single shops that have started a public instagram profile is not feasible. Hence, would there be a way to extract that data using going through the authentication process as described by the API?
Thanks.
My answer is that you need need authentication with some IG account first. After that, the information is all available as long as the account you are looking at is 'public'
API doesn't provide the list of follower anymore even if you are authentificate
You need to do some other technique like the web scraping one (parse the code of the HTML )
This is seriously not my area and the question I was answering to has been closed.
I have spent so long trying to figure this out and although it is a very different solution it's probably going to work for longer.
Open your browser in Mobile mode (no idea how to do).
I have used a python script which did this for me but I will update it with help from the comments
Open a New Tab, acess the profile you want to explore and press followers/following respectively.
Looking at the list of followers/folowing
Inspect any element and go to 'Console' at the top
On the console, paste this and hit Enter.
const arrHtml = document.getElementsByClassName('_ab8w _ab94 _ab99 _ab9f _ab9m _ab9p _abb- _abcm');
while (!!arrHtml.length) {
arrHtml[0].parentNode.removeChild(arrHtml[0])
}
And this
const arrHtml = document.getElementsByClassName('_ab8w _ab94 _ab99 _ab9f _ab9m _ab9p _abbj _abcm');
while (!!arrHtml.length) {
arrHtml[0].parentNode.removeChild(arrHtml[0])
}
And this
const arrHtml = document.getElementsByClassName('_ab8y _ab94 _ab99 _ab9f _ab9m _ab9p _aba_ _abcm');
while (!!arrHtml.length) {
arrHtml[0].parentNode.removeChild(arrHtml[0])
}
And this
const arrHtml = document.getElementsByClassName('_ab8w _ab94 _ab97 _ab9h _ab9k _ab9p _abb0 _abcm');
while (!!arrHtml.length) {
arrHtml[0].parentNode.removeChild(arrHtml[0])
}
Now that everything has been stripped away, except for the usernames.
Click anywhere and use Ctrl + A
Copy (Ctrl + C)
And paste (Ctrl + V) wherever you like. enjoy'
In my features file, I have something like this:
Background:
Given I am on login screen
Then I log in
Scenario:
Given I am on a random account summary
when I try feature-1
Then I see some output-1
Scenario:
Given I am on account summary
When I try feature-2
Then I see some message
When cucumber executes 2nd scenario, it re-executes the background.
My question is-
Is it possible to tell Cucumber to use the same browser session/state from previous scenario?
This will help my tests save some execution time.
Capybara resets sessions before each scenario so you should login explicitly before each of them. But as you don't test login in every scenario, I'd advice to automate this process.
At first, you can make your background more declariative:
Background:
Given I'm logged in
Look at this article, it shows why it's better to do it.
Then you can:
Generate new session at back-end
Send session cookie from back-end to your test
Set cookie to Capybara. Capybara doesn't have cross-driver API for it so you can use:
Webdriver:
page.driver.browser.manage.add_cookie(name: 'name', value: 'value')
Capybara-webkit:
page.driver.browser.set_cookie('c_user=asdasdasd; domain=.domain.com')
Poltergeist:
page.driver.set_cookie('name', 'value')
RackTest doesn't seem to fully support it. As a workaround you can do:
get new_service_request_path, {}, 'HTTP_COOKIE' => 'name=value'
I think you have a number of options using Before and After hooks, as well as tagging. I'd start reading here: https://github.com/cucumber/cucumber/wiki/hooks
Something like this:
Before do
AccessRandomAccountPage() #Assumes you're logged in already
end
Or if this is specific to a set of tests, like you're "AlreadyLoggedIn" tests, you could use tagging:
Before ('#AlreadyLoggedIn') do
AccessRandomAccountPage()
end
In the your feature file, you are used the background:, it is executed for all scenario, to avoid to call every time(details of Background), please changes Background: into Scenario: and it is enough to tell Cucumber to use the same browser session from previous scenario
Scenario:
Given I am on login screen
Then I log in
Scenario:
Given I am on a random account summary
when I try feature-1
Then I see some output-1
Scenario:
Given I am on account summary
When I try feature-2
Then I see some message