How can I do it in my bot? - bots

I'm new here and I have a question
I want to create telegram bot
and I want to send to every member in this bot a message that only him can see it
what I mean if I have 100 person on my bot
I want to send 100 message to 100 person but every person will get 1 message
and all the 100 people will get different message to another one
so how can I do it ?
please enlighten me ...

this is simple GET method:
https://api.telegram.org/bot<token>/sendMessage?chat_id=<chat_id>&text=<text>
chat_id is unique for any user, you can send one, two or more different message to any user - just use different chat_id and text.
or if you want to sent one message to all user - just call this get method with one text and diff chat_id

Related

Fetch discord’s message containing specific words

How do i find messageID of the latest message from a specific user containing certain word
i.e
if 2 people sends same message but if i provide 1st person’s userID then it will bypass 2nd users message and get the messageID of 1st users'
I dont know if this is possible haven’t done anything yet!

Dialogflow inline editor ask for additional info

I am developing a google assistant app on Dialogflow.
And I have a intent that receives two entities: #name and #age
Using the fulfillment throught the inline editor I verify if the #age is below 18.
In that case I need to ask for additional info, I need to ask the name of the person responsible for the child.
I looked around the internet, including the fulfillment samples at https://dialogflow.com/docs/samples
I believe it would look something like this:
let conv = agent.conv();
conv.ask('As your age is under 18 I need the name of the person responsible for you:');
//Some code to retrieve user input into a variable
agent.add(conv);
But I was unable to find how to do it.
Can someone help me to achieve this?
Thanks in advance.
While you are handling an Intent, there is no way to "wait for" the user to respond to your question. Instead, you need to handle user input this way:
You send a response back from your Intent.
The user replies with something they say.
You handle this new user statement through an Intent.
Intents always represent the user taking some action - usually saying something.
So one approach would be to create a new Intent that accepts the user's response. But somehow you need to distinguish this response from the initial Intent that captured the person's name.
One way to do this would be, in the case you ask the question about who the responsible adult is, is to also set a Context. Then you can have a different Intent be triggered only when that Context is set and handle this new Intent to get the name of the adult.

How to make the bot initiate 1:1 conversation in a group with the user in Slack using Microsoft bot-framework?

I am using Microsoft bot-framework for Nodejs. I want my bot to start a private conversation within a group with a user. Currently, my bot carries on the conversation with any member responding.
For example,
Me: Hi #bot
Bot: Hi
Me: I need to order a pizza
Bot: What would you like on your pizza?
SomeTeamMember: Mushrooms and Onions
Bot: Ordering Pizza with Mushrooms and Onions.
As you can see, the conversation was hijacked by some other member, this is the issue I am facing, I want to avoid this from happening. I want the bot to only communicate with one member at a time and when the conversation ends with that user, it is open to communicate with anyone in the same manner as previous user. Any suggestion would be great!
You are using slack? Anyway, when you reach "Bot: What would you like on your pizza?", you should be in a completely new dialog where you can use each conversation member Id and store it to data bag (context.ConversationData) in order to have context.
When "SomeTeamMember" joins the conversation, you can check his or hers conversation member id to get the state for each member, and act accordingly.
Hope this helps :)
Alex
I think you could use the session object and access the message sender id i.e session.message.user.id. And maybe filter out messages coming from other users other than the one that said I need to order a pizza.
Also from the documentation I think you could use something like dialog triggered by an action, activated right after I need to order a pizza.
You could then check the user's id, and reroute to dialogs where the other users will be filtered out, except for the sender of I need to order a pizza...
If you try something like, or complexify:
bot.dialog('pizzarouting', function (session, args, next) {
})
// Once triggered, will start a new dialog as specified by
// the 'onSelectAction' option.
.triggerAction({
matches: /^Pizza$/i,
onSelectAction: (session, args, next) => {
// Add the help dialog to the top of the dialog stack
// (override the default behavior of replacing the stack)
session.send('What would you like on your pizza?')
console.log(session.message);
// Reroute to dialog that filter out the other people id
// session.beginDialog(args.action, args);
}
});
This gets activated only if a user sends 'Pizza' in chat.
You'll see that the session object holds the message object, which you could use for example to identify the user who sent I need to order a pizza and get his id for subsequent filtering.
I hope you or anyone who gets around this gets interesting ideas.

When does Message ID get populated in Lotus Notes?

I'm trying to use the Message ID property on a mailbox item to determine whether it's a journaled or non-journaled item.
When I say non-journaled I mean, calendar events, contacts, drafts.
Is this the right thing to do? Is the Message ID assigned when the item is sent?
The Messsage ID is assigned to the $MessageID item by the router when the message is submitted to be sent. A calendar event will not contain a $MessageId, but a calendar invitation or calendar notice will, because they are processed by the mail system.
However, the presence of a $MessageId item does not necessarily mean the message was mailed to or by the specific mailbox that you are looking at, because a message can easily be copied and pasted between mailboxes.
And it's also true that the absence of a $MessageID does not necessarily mean it wasn't mailed, either. I am almost certain that I've seen cases where messages in a user's Sent folder, and which were actually sent, didn't have the $MessageID. I can't recall the circumstances for that, though. (It's pretty easy for a knowledgeable user to remove the $MessageID item from a message by running a simple agent, so that's an obvious reason why you can't count on the $MessageId being there, but that's not the case I'm thinking of.)(

GMail IMAP - How to get conversations (threads) list?

I am trying create similar view like in GMail. I know that GMail IMAP
have extension X-GM-THRID which I can use in FETCH command, but this
return me this same numbers of items and I must group them manually by
thread ID. Exists any faster way to group this? I am mean, can google
imap server return me list of messages grouped by thread id (like in gmail web interface)? To be more specific:
If I have this list (THREAD ID | TEXT)
12345 "hello"
12345 "hi"
12345 "what's up?"
67890 "are you there?"
67890 "no, I'm not"
I want get from server only:
12345 "hello"
67890 "are you there?"
Can I do that? Finally, I would have to group this by my self, but this solution is inefficient and slow (I have many messages to group)
Regards and sorry for my English.
The 'In-Reply-To' header of the child should have the value of the Message-Id header of the parent.
There is one another field in header 'References' which contains message ids of all its parent.
you can user either of them as per your requirement.
Years old, but:
The unsatisfying answer is: you can't --- IMAP only knows about messages, not threads, so you can only get thread information by looking at all the messages and aggregating.that.
What you can do is to fetch just the UID and X-GM-THRID fields, which is fast (about 40 bytes or so per message). Then you find the first message for each thread, then use UID FETCH to pull just those. By not fetching the entire message envelope until you know which messages to fetch you save a lot of bandwidth.

Resources