Glympse API - PreSet a Nick Name - glympse

I want to preset the nickname of the sender which will be shown at the receiver's end while sending the Glympse Ticket.
Issue :- When first time the sender is sending a Glympse it asks for Saving and Sending with a nick name, rather I have already set a nick name with the code detailed below.
GGlympseLite glympse = GlympseLiteWrapper.instance().getGlympse();
glympse.setNickname(DCCApplication.session.getName());
While the above code works fine from the second time onwards, but it asks for the Nick Name when the user is sending the Glympse for First Time, and it asks for the nickname everytime till the User has entered once in that popup.
Please let me know why is it so?
Thanks

Your code for setting the nickname is perfect, but there is one very recent change in our SDK that is causing it to not set properly. The Glympse platform must be synchronized with the server before calling setNickname(). This change is mentioned under 2.6.54 in our change log:
https://developer.glympse.com/Content/client/full/android/guides/Glympse_Api_Android_Changelog.html
Implement GListenerLite as specified here:
Glympse API - Handle Send Ticket Operation
And listen for the LC.EVENT_SYNCED event.
#Override public void eventsOccurred(GGlympseLite glympse, int event, Object param1, Object param2)
{
if (0 != (event & LC.EVENT_SYNCED))
{
Log.d("", "Synced with server");
GlympseLiteWrapper.instance().getGlympse().setNickname(DCCApplication.session.getName());
}
}

Related

Identify first sign in with Authentication using AD for Microsoft Bot Framework

I would like to give a login successful message to the user when he sign in for the first time. So i need to identify weather the user have used sign card shown to sign in(user have interacted) or system automatically taken the token itself without user intervention. It will be nice we show a successful message user interaction was there. How i can identify weather there was a user interaction or not?
The answer I found is to find the Activity Type if its event type user have interacted else it’s an automatic signin. You can reverify the connection just established by checking the value of key connectionName in Activity.Value. The following code will help you.
string output = JsonConvert.SerializeObject(stepContext.Context.Activity.Value, Formatting.Indented);
if (stepContext.Context.Activity.Type is "event")
{
var conName = JsonConvert.DeserializeObject<JObject>(output)["connectionName"].ToString();
if (conName ==<Your Connection Name>)
{
await stepContext.Context.SendActivityAsync(MessageFactory.Text($"You have successfully Signed In"), cancellationToken);
await stepContext.Context.SendActivityAsync(MessageFactory.Text($"How can I help you?"), cancellationToken);
}
}

Responding to Conversations async: Graph or Bot?

I have a Teams Message extension that returns a Task response which is a medium sized embedded web view iFrame
This is working successfully; including added a custom Tab within the channel and other nice magic calls to Microsoft Graph.
What I am confused about is how to do (and this is probably my not understanding the naming of things)
insert "something" Back into the Message/Post stream which is a link to newly created Tab ... like the what you get when you have a "configureTabs" style Tab created -- there is a friendly Message (Post) in the chat pointing to this new Tab.
do I do this with Microsoft Graph or back through the Bot?
the code that does the communication may be a different service elsewhere that is acting async ... so it needs to communicate with something somewhere with context. Confused if this is the Bot with some params or Microsoft Graph with params.
how to insert an image (rather than a link to the tab) into the Message/Post stream -- but showing the image not a link off to some random URL (ie: )
could not find any samples that do this; again, will be async as per above; but the format of the message will be a Card or something custom?
So just to be clear, a Task Response is NOT the same as a Tab, albeit that they might end up hosted in the same backend web application (and also albeit that your TAB can actual bring up your Task Response popup/iframe using the Teams javascript library).
Aside from that, in order to post something back to the channel, like when the Tab is created, there are two ways to do so:
First is to use Graph Api's Create ChatMessage option (this link is just for a channel though - not sure if your tab/task apply to group chats and/or 1-1 chats as well).
2nd Option is to have a Bot be part of your application as well. Then, when you're ready to send something to the channel, you'd effectively be sending something called a "pro-active messaging". You need to have certain reference data to do this, which you would get when the bot is installed into the channel ("conversation reference", "ServiceUrl", and so on). I describe this more in my answer at Programmatically sending a message to a bot in Microsoft Teams
With regards sending the image, either of the above would work here too, in terms of how to send the image. As to the sending of an image, you'd need to make use of one of the kinds of "Cards" (basically "richer" messages than just raw text). You can learn more about this at Introducing cards and about the types of cards for Teams at Card reference. There are a few that can be used to send an image, depending on perhaps what else you want the card to do. For instance, an Adaptive Card can send an image, some text, and an action button of some sort.
Hope that helps
To close the loop for future readers.
I used the following Microsoft Graph API docs, and the posting above, and this is working: Create chatMessage in a channel and Creating a Custom Microsoft Graph call from the SDK
The custom graph call (as it is not implemented in the .NET SDK at the time of this response) looks something like:
var convoReq = $"https://graph.microsoft.com/beta/teams/{groupId}/channels/{channelId}/messages";
var body = this.TeamsMessageFactory(newCreatedTabUrl, anotherstring).ToJson();
var postMessage = new HttpRequestMessage(HttpMethod.Post, convoReq)
{
Content = new StringContent(body, System.Text.Encoding.UTF8, "application/json")
};
await _graphClient.CurrentGraphClient.AuthenticationProvider.AuthenticateRequestAsync(postMessage);
var response = await _graphClient.CurrentGraphClient.HttpProvider.SendAsync(postMessage);
if (response.IsSuccessStatusCode)
{
var content = await response.Content.ReadAsStringAsync();
return true;
}
The groupId and channelId are found elsewhere; and the TeamsMessageFactory is just some boilerplate that serialized the C# object graph for the POST request, as detailed in Create chatMessage in a channel

Return initial data on subscribe event in django graphene subscriptions

I'm trying to response to user on subscribe. By example, in a chatroom when an user connect to subscription, the subscription responses him with data (like a welcome message), but only to same user who just connect (no broadcast).
How can I do that? :(
Update: We resolve to use channels. DjangoChannelsGraphqlWs does not allow direct back messages.
Take a look at this DjangoChannelsGraphQL example. Link points to the part which is there to avoid "user self-notifications" (avoid user being notified about his own actions). You can use the same trick to send notification only to the user who made the action, e.g. who just subscribed.
Modified publish handler could look like the following:
def publish(self, info, chatroom=None):
new_msg_chatroom = self["chatroom"]
new_msg_text = self["text"]
new_msg_sender = self["sender"]
new_msg_is_greetings = self["is_greetings"]
# Send greetings message only to the user who caused it.
if new_msg_is_greetings:
if (
not info.context.user.is_authenticated
or new_msg_sender != info.context.user.username
):
return OnNewChatMessage.SKIP
return OnNewChatMessage(
chatroom=chatroom, text=new_msg_text, sender=new_msg_sender
)
I did not test the code above, so there could be issues, but I think it illustrates the idea quite well.

How would I design this scenario in Twilio?

I'm working on a YRS 2013 project and would like to use Twilio. I already have a Twilio account set up with over $100 worth of funds on it. I am working on a project which uses an external API and finds events near a location and date. The project is written in Ruby using Sinatra (which is going to be deployed to Heroku).
I am wondering whether you guys could guide me on how to approach this scenario: a user texts to the number of my Twilio account (the message would contain the location and date data), we process the body of that sms, and send back the results to the number that asked for them. I'm not sure where to start; for example if Twilio would handle some of that task or I would just use Twilio's API and do checking for smss and returning the results. I thinking about not using a database.
Could you guide me on how to approach this task?
I need to present the project on Friday; so I'm on a tight deadline! Thanks for our help.
They have some great documentation on how to do most of this.
When you receive a text you should parse it into the format you need
Put it into your existing project and when it returns the event or events in the area you need to check how long the string is due to a constraint that twilio has of restricting messages to 160 characters or less.
Ensure that you split the message elegantly and not in the middle of an event. If you were returned "Boston Celtics Game", "The Nut Cracker Play". you want to make sure that if both events cannot be put in one message that the first message says "Boston Celtics Game, Another text coming in 1 second" Or something similar.
In order to receive a text message from a mobile device, you'll have to expose an endpoint that is reachable by Twilio. Here is an example
class ReceiveTextController < ActionController
def index
# let's pretend that we've mapped this action to
# http://localhost:3000/sms in the routes.rb file
message_body = params["Body"]
from_number = params["From"]
SMSLogger.log_text_message from_number, message_body
end
end
In this example, the index action receives a POST from Twilio. It grabs the message body, and the phone number of the sender and logs it. Retrieving the information from the Twilio POST is as simple as looking at the params hash
{
"AccountSid"=>"asdf876a87f87a6sdf876876asd8f76a8sdf595asdD",
"Body"=> body,
"ToZip"=>"94949",
"FromState"=>"MI",
"ToCity"=>"NOVATO",
"SmsSid"=>"asd8676585a78sd5f548a64sd4f64a467sg4g858",
"ToState"=>"CA",
"To"=>"5555992673",
"ToCountry"=>"US",
"FromCountry"=>"US",
"SmsMessageSid"=>"hjk87h9j8k79hj8k7h97j7k9hj8k7",
"ApiVersion"=>"2008-08-01",
"FromCity"=>"GRAND RAPIDS",
"SmsStatus"=>"received",
"From"=>"5555992673",
"FromZip"=>"49507"
}
Source

How to cancel an calendar event using ics files?

One of our requirements is to create iCalendar files (.ics) and send them each in emails as an attachment. We are using DDay.Ical.dll to create ics files as under:
// Create a new iCalendar
iCalendar iCal = new iCalendar();
// Create the event, and add it to the iCalendar
Event evt = iCal.Create<Event>();
// Set information about the event
evt.Start = new iCalDateTime(SomeStartTime);
evt.End = new iCalDateTime(SomeEndTime);
evt.Location = "At so and so place";
evt.Description = "Some Description";
evt.Summary = "About Some Subject";
iCal.Method = "PUBLISH";
// Serialize (save) the iCalendar
iCalendarSerializer serializer = new iCalendarSerializer();
serializer.Serialize(iCal, #"iCalendar.ics");
Complete process is:
User1 create an iCal file for specific date and time and send it to User2.
User2 will open the ics file and accept the invitation. An appointment item will be created in User2's LOCAL outlook.
Now, Suppose, because of any reason if appointment is cancelled, then User1 HAS to create an ics file and send it to User2, so that User2 can cancel his event from the local outlook.
How to create such ics file?
File gets created in the same way as the original ics file. The event status will be different. UID will identify the event and sequence number will indicate priority of update, and then the event details will be noted (changes or cancellations)
If you want to change/cancel an event after sending out an invitation, you need to identify the event/appointment by its UID, and allocate a bigger SEQUENCE number than the original ics event.
UID (unique identifier) : https://www.rfc-editor.org/rfc/rfc5545#page-117
Sequence: https://www.rfc-editor.org/rfc/rfc5545#page-138
and set the event status
/ "CANCELLED" ;Indicates event was cancelled.
Status: https://www.rfc-editor.org/rfc/rfc5545#page-92
oh - and method
If you need to send in a cancellation for an event the UID should be same as the original event and the component properties should be set to cancel Ex.
METHOD:CANCEL
STATUS:CANCELLED
Of course this will only 'cancel' the event if the recipient then actually clicks to load/subscribe it into the same calendar app as the first time.
For applications that have 'subscribed' the the remote ics - when they next do an 'update' check the update should be processed and overwrite the original event.
Old thread, but just wanted to give my input.
Also had the problem with outlook showing "not supported format" on a cancel ics. Tried to change METHOD to REQUEST, sort of solved the problem in Outlook, but Gmail and others was not handling it well, looked like an invite, with yes/no/maybe buttons.
After much (MUCH) looking around for solve the problem, I finally realized that the problem was not within the ics file, but how the file was attached to the email. I added it with method:REQUEST. After changing that to method:CANCEL it works well in all clients.
contype = new System.Net.Mime.ContentType("text/calendar");
//contype.Parameters.Add("method", "REQUEST");
contype.Parameters.Add("method", "CANCEL");
contype.Parameters.Add("charSet", "utf-8");
contype.Parameters.Add("name", "invite.ics");
Edit all the events in the ics file using any text file editor (eg. Visual Studio Code) and import modified the calenar again:
I had the issue when i sent mail containing ics file for delete event but in outlook it show me not supported format
then i figured out somewhere on net and i found that i just need to change
METHOD: CANCEL to METHOD: REQUEST
when i import this in outlook

Resources