How to send notification to all users - getstream-io

I want to send notification to all users that are following me.
in the e.g,
$activity = array('actor'=>$user->username, 'verb'=>'ping', 'object'=>$ping->id);
$feed = $client->feed('notification', $pingTarget->id);
$feed->addActivity($activity);
what will be the value of object $ping->id and $pingTarget->id.
how we can send notification to multiple users that are following me

The simplest way to do this is to create a follow connection between user feed and its followers' notification feeds.
eg. if user A, B and C follows user D you should create the following connections:
$client->feed('notification', 'user:A')->follow('timeline', 'user:D');
$client->feed('notification', 'user:B')->follow('timeline', 'user:D');
$client->feed('notification', 'user:C')->follow('timeline', 'user:D');
Activities added to the feed of user D will be delivered to followers' notification feeds.

Related

How to get information out of a list

So iam coding an discord bot and i want to get information out of an list that looks like this and this output is in "information = await guild.invites()"
[<Invite code='GZqCe8EF' guild=<Guild id=847546806937059338 name='Testing' shard_id=None chunked=False member_count=2> online=None members=None>, <Invite code='jQ2HeQfx' guild=<Guild id=847546806937059338 name='Testing' shard_id=None chunked=False member_count=2> online=None members=None>]
is it possible to get single things out like guild id or maybe 2 things like name and invite code and is it possible that u can output every line from it like the first invite code and the second one?
To output every invite code, you can use:
for invite in information:
print(invite.code) #invite.code returns the invite code, do whatever you want to do with it
# you can also add invite.guild.name to for the guild name etc
To output only from one invite:
print(information[0].code)
References
invite object with every possible paramenter after .
Yes it is possible, the invites() method returns list of Invite objects. To check what attributes does this object have look here.
to access an attribute you have to do this: InviteObject.{name of attribute}. Example:
for invite in information:
print(invite.guild.id)
It works the same for any discordpy object:
Look for the method that you are using in discordpy docs (In your case invites())
See what does it return (In your case list of Invite objects)
Search for the object (In your case Invite)

Spring Integration DSL : Send messages to multiple subscribers (not to all subscribers) based on the message payload

I have to create a pipeline to send messages to multiple subscribers, I can achieve this using publishSubscribeChannel.
But in my case when I receive the message - I have a eventSubType like
<ns1:eventSubType>0:INIT-SHIP-ASSIGN,BKD,</ns1:eventSubType>
I have to check if the eventSubType Contains INIT-SHIP-ASSIGN then I will route it o "INIT-SHIP-ASSIGN" channel and if its "BKD" then I have to route it to "Booked" channel. Similarly we have other eventSubTypes.
My challenge is - I have 5 different subtypes and in each message we can have multiple subtypes. So, based on the event subtypes (can be more than 1) available in the message, we have to send the message to the multiple subscribers but not to all the subscribers.
Please suggest
Use a recipient list router instead.
.routeToRecipients(r -> r
.recipient("thing1-channel", "'thing1' == payload")
.recipientMessageSelector("thing2-channel", m ->
m.getHeaders().containsKey("recipient")
&& (boolean) m.getHeaders().get("recipient"))
...

infusionsoft contact field query with python

I know how to connect to Infusionsoft with Python 3 and how to process the following simple example:
#Set up the contact data we want to add
contact = {}; #blank dictionary
contact[“FirstName”] = “John”;
contact[“LastName”] = “Doe”;
contact[“Email”] = "john#doe.com";
contact[“Company”] = “ACME”;
But how do I mass update the WHOLE database? e.g. If I want to update ALL The Phone1 fields with an extra bit of code using IF statements.
Using Infusionsoft API you can only update contacts data one by one, sending a separate request per contact. Exact request depends on which type of API you use: REST or XML-RPC

How to count number of activities in a getstream feed?

Does getstream provide a way to retrieve the number of activities within a feed? I have a notification feed setup. I can retrieve the activities using paginated get. However, I would like to display the number of items within the feed.
Unfortunately not, there is no API endpoint to retrieve the amount of activities within a feed.
At the moment there's no way to count activities directly. You can try
Use a custom feed and use reactions. So now you call count from reactions.
Other way is store in your app (cache/db/etc).
It worked for me:
signature = Stream::Signer.create_jwt_token('activities', '*', '<your_secret>', '*')
uri = URI("https://us-east-api.stream-io-api.com/api/v1.0/enrich/activities/?api_key=<api_key>&ids=<id1,id2,...>&withReactionCounts=true")
req = Net::HTTP::Get.new(uri)
req['Content-Type'] = "application/json"
req['Stream-Auth-Type'] = "jwt"
req['Authorization'] = signature
res = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) {|http|
http.request(req)
}
puts JSON.parse(res.body)
References:
Retrieve
reactions_read-feeds
activities
ruby client
Update 2022
You can only get the number of activities in groups within aggregated or notification feeds. Flat feeds are still not supported.
Source
The best solution is to store important numbers in the database which Stream provides.
Source

Error in checking an email id is valid using Mail::CheckUser

I am creating a script for checking mail id inbox exist or not (mail probing), i am using Mail::CheckUser module for this.But when i execute the code with a mail id like "somthing#yahooo.com" it shows the mail id exist ,but it does not exist in reality.
could you please suggest any solution for this
the code i am usig is given below
use Mail::CheckUser;
use Data::Dumper;
my $res =Mail::CheckUser::check_email('something_something#yahoo.com');
print $res."\n\n\n";
my $res1 = Mail::CheckUser::last_check();
print Dumper($res1)."\n\n";
thanks in advance
Mail::Checker seems to be unfit for Yahoo
It seems that it is impossible to test existence of yahoo mailbox without sending a test message. Yahoo seems to reject messages to non existing user in reply to "the final dot" in SMTP session.
I have tried to send message to non existing (long random) mailbox with the following result (bounce message):
<d5b980c9018f82c94cefee51193f8a61#yahoo.com>: host
mta5.am0.yahoodns.net[98.138.112.32] said: 554 delivery error: dd This user
doesn't have a yahoo.com account
(d5b980c9018f82c94cefee51193f8a61#yahoo.com) [0] -
mta1516.mail.ne1.yahoo.com (in reply to end of DATA command)

Resources