Node Imap cannot change seen to unseen for office 365 - imap

I am trying to update flag of a email message from offcie 365 account from 'seen' to 'unseen' using node imap. I don't get any error but the message still remains seen. Same code works for Gmail. Similar logic works for office 365 for flagging a message with 'flag' and to mark message as 'seen'.
Any idea why 'seen' to 'unseen' doesn't works for Office ? Below is my code snippet
imap.setFlags(seqno, 'UNSEEN', function(err) { //Tried Unseen, unseen etc..
if (err) return err;
imap.closeBox(function(err) {
if (err) return err;
imap.logout();
});
});

As mentioned by Max, 'delFlags' works out. But wondering why setting flag to 'unseen' doesn't work for Office365.

Related

Microsoft Graph returning Resource Not Found

I've registered an app in Azure AD and given it API permissions(both Application and delegated) to read all AD groups (Group.Read.All, also Directory.Read.All etc). Using this app I am using Graph Service Client to make a call to get user's AD groups.
public async Task<IEnumerable<GroupInfo>> GetAllGroupsOfUser(string mail)
{
IList<GroupInfo> result = new List<GroupInfo>();
IUserMemberOfCollectionWithReferencesPage memberOfGroups = await _graphServiceClient.Users[mail].MemberOf.Request().GetAsync();
.......... More code ........
}
It works fine for most of the users email but for few emails, which are present in the active directory, I'm getting the following exception
Code: Request_ResourceNotFound Message: Resource 'someuser#somedomain.co' does not exist or one of its queried reference-property objects are not present.
Your error is not that you lack certain permissions, and it has nothing to do with which api testing tool you are using. Your error is very simple. As your error message says, it is that you entered the wrong user email.
Your error message has clearly stated that there is no'someuser#somedomain.co' email, because this is not a correct email, it should be .com instead of .co.
So you must make sure that you enter the correct email without special characters or spaces.
This is my test result:
1.
2.

Zendesk Chat widget status check

I am using the Zendesk chat widget on my web portal. My requirement is whenever the widget goes down from server "Zendesk site" check the status and send notification to site owner.
On the research I found the $zopim.livechat.setOnStatus(callback); method. But the disadvantage of this gives only the offline and online status.
The "Status" that is checked with the callback function setOnStatus will only ever refer to the actual chat status rather than a technical health check status.
It's a little clunky, but if you're expecting the widget to load, but it doesn't due to the service being down, you could do a manual check after a given time, and have a reporting callback (Dummy function your_error_callback):
// Check Zopim (Zendesk Chat) status after 10 seconds
var ZopimHealthCheck = setInterval(function () {
if (window.$zopim === undefined || window.$zopim.livechat === undefined) {
your_error_callback("Zendesk Chat not available");
}
clearInterval(ZopimHealthCheck);
}, 10000);

Twilio SMS sending

await client.messages.create(
{
to: `+${userEntity.telephoneNumber}`,
from: `+${process.env.TWILIO_NUMBER}`,
body: `Your activation code is ${userEntity.activationCode}`,
},
(err, message) => {
if (err) {
throw err
} else {
return this._res.status(200).json({message: message}).end()
}
}
);
Error: The number +xxxxxxx is unverified. Trial accounts cannot send messages to unverified numbers; verify +xxxxxxx at twilio.com/user/account/phone-numbers/verified, or purchase a Twilio number to send messages to unverified numbers.
Hi everyone. I was trying to send a message from Twilio to the user but I've got this error.Who can help me? Maybe I don't understand how does it work. Should I add a number to which I want to send a message to Twilio? Or what does this message mean?
Yes that is exactly what it means, you have to verify the number you want to send your message to. The verification is done by either a call or a text.
Twilio - Verify Phone number
This will also allow you to use this number as a caller id when making a call(does not work with texting).
This is a somewhat common limitation setup for trial accounts.

Twilio chat client channels list

I am trying to create a simple chat app between 2 users, using twilio js api.
The idea is that I know that two users will have to chat with each other, and I want to create a channel specifically for the chat between them both.
So when a user logs in, I want to search the channel by it's name:
if it exist already, it means that the other user is already logged, and I want to join this channel.
else, I want to create a channel by this specific name, and wait for the other user.
I tried 2 alternatives:
1. chat client.
2. IPMessaging client.
I am trying to user this function:
chatClient.getChannels().then(function (channels){ // search for the channel I need // }
But for chat channel I get the following error:
twilio TypeError: chatClient.getChannels is not a function
So with an IPMessaging client it all works well, but I can't trigger events of user typing, which are important for my app:
chatChannel.on('typingStarted', function(){
console.log('user started typing')
});
chatChannel.on('typingEnded', function(){
console.log('user stopped typing')
});
Should this events be possible to trigger for IPMessaging Client?
If not, how can I get the channels list for a chat client?
Thank you
You can trigger typing indicators with IPMessaging (Programmable chat):
https://www.twilio.com/docs/api/chat/guides/typing-indicator
//intercept the keydown event
inputBox.on('keydown', function(e) {
//if the RETURN/ENTER key is pressed, send the message
if (e.keyCode === 13) {
sendButton.click();
}
//else send the Typing Indicator signal
else {
activeChannel.typing();
}
});
That same event can be triggered for members, and not only channels.
https://media.twiliocdn.com/sdk/js/chat/releases/0.11.1/docs/Member.html

Subscribing email address to MailChimp from iOS app

I have added a contact form to my app that allows users to send feedback to me directly via email. I'm using Mandrill and Parse, and it works well!
On the contact form is an "Add me to mailing list…" option, and I'm looking for a way to add the user's email to MailChimp automatically if this option is checked.
I understand that there's a MailChimp API that's accessible by Objective C through a wrapper, though I'm wondering if there's not a more straightforward way to simply add an email to a MailChimp mailing list in iOS/Objective C?
Thanks for reading.
EDIT #1: Progress, but not yet success.
1) I've added cloud code from this answer to Parse (substituting in the two keys, where KEY2 is last three characters of MailChimp key):
var mailchimpApiKey = "MY_MAILCHIMP_KEY";
Parse.Cloud.define("subscribeUserToMailingList", function(request, response) {
if (!request.params ||
!request.params.email){
response.error("Must supply email address, firstname and lastname to Mailchimp signup");
return;
}
var mailchimpData = {
apikey : mailchimpApiKey,
id : request.params.listid,
email : {
email : request.params.email
},
merge_vars : request.params.mergevars
}
var url = "https://KEY2.api.mailchimp.com/2.0/lists/subscribe.json";
Parse.Cloud.httpRequest({
method: 'POST',
url: url,
body: JSON.stringify(mailchimpData),
success: function(httpResponse) {
console.log(httpResponse.text);
response.success("Successfully subscribed");
},
error: function(httpResponse) {
console.error('Request failed with response code ' + httpResponse.status);
console.error(httpResponse.text);
response.error('Mailchimp subscribe failed with response code ' + httpResponse.status);
}
});
});
2) And I've added this Objective-C code to my iOS project (adding in my MailChimp list ID):
[PFCloud callFunctionInBackground:#"subscribeUserToMailingList" withParameters:#{#"listid":#"MY_LIST_ID",#"email":userEmail,#"mergevars":#{#"FNAME":firstName,#"LNAME":lastName}}
block:^(NSString *result, NSError *error){
if (error) {
//error
} else {
}
}];
The result? This error:
Error Domain=Parse Code=141 "The operation couldn’t be completed. (Parse error 141.)" … {error=Mailchimp subscribe failed with response code 500, code=141}
EDIT #2: More progress, but not yet success.
The previous error was being caused by an attempt to add an email address to the mailing list that was already there. I am now getting no errors and a "Successfully subscribed" result in the block above. However, logging in to MailChimp, the new address is still not there.
OK, turns out the code is fine! Please use, share, and enjoy.
The issue was that MailChimp (smartly) requires double opt-in for mailing lists.
The first opt-in is running this code with a specific userEmail, and it results in an email being sent to your to-be-added user.
The email asks them to confirm their subscription, and if they do so (it's a link in the email), that's the second opt-in. Then, their email is added to your list.
So, bottom line is that the code doesn't automatically add a user to your mailing list—their confirmation is still required. It's a nice way to make sure people on your mailing list actually want to be there (i.e., have a chance of reading your emails)!

Resources