How to get user id using email id in teams using python - python-3.x

I'm creating a bot to notify a user after an action has been done. Where i'm able to get my details using the below(screenshot) code.
Now in order to send a message to a user through a bot i would need his/her ID before hand to send a notification like in the above case i'm able to extract my info as i'm already logged in Teams. Unfortunately alphanumeric ID is very difficult to use and needs to be there before requesting and sending the notification.
Below is the JSON result if the ID is already known.
Response body
{
"id": "29:1GcS4EyB_oSI8A88XmWBN7NJFyMqe3QGnJdgLfFGkJnVelzRGos0bPbpsfJjcbAD22bmKc4GMbrY2g4JDrrA8vM06X1-cHHle4zOE6U4ttcc",
"objectId": "9d3e08f9-a7ae-43aa-a4d3-de3f319a8a9c",
"givenName": "Larry",
"surname": "Brown",
"email": "Larry.Brown#fabrikam.com",
"userPrincipalName": "labrown#fabrikam.com",
"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47",
"userRole":"user"
}
How i can get the unique ID of the user by using email id so that i can send a personal message to him/her using bot.

There is an option to fetch conversationChatId to send proactive message.
Before you fetch the conversation Id, you should check whether your bot is currently installed for a message recipient or not.
Note: Installation of app via Graph API triggers conversation update event for Bot.

Related

Send metadata in WhatsApp Cloud Api

Somehow, in order to send a response to the client, I must be able to pass the user's id as metadata or parameter, for example: The reservation request is sent to a restaurant, after that, the restaurant confirms the reservation, in the Confirmation A WhatsApp is sent to the user to inform him that his reservation is confirmed.
For it:
WhatsApp with restaurant id metadata to confirm.
Whatsapp with the confirmation to the user (I must know the id of the
restaurant)
In the object returned by WhatsApp I have a context, however I can't find any method to get the information from the context.
I want to send the object:
"messaging_product": "whatsapp",
"to": "52" + recipient,
"metadata":{
"idUser": 60,
"idBranch": 76
},
"type": "template",
and retrieve the context to know the ID.
Unfortunately, WhatsApp Business API does not have any option to pass metadata in the send message API,
The real approach is you need to store that message-id in your database, whenever you receive webhook object, match that object's message-id in the stored message-id from the database, and do whatever further actions.

Slack webhook not sending personal message

I am trying to send personal message to particular user using webhook. I created webhook so i am getting personal message. But I am not able to send personal message to others personal chat. I don't want to use bot.
slack.setWebhook("Webhook");
slack.webhook({
channel: "D01KMUZ4E4S",
username: "webhookbot",
text: "This is posted to #general and comes from a bot named webhookbot."
}, function(err, response) {
console.log(response);
});
Slack Webhook URLs are tied to a particular channel, individual message, or group message. You need to create a new webhook in your workspace for each user you would like to send messages to.

C# Docusign API - Getting Remote Signing View URL

After running the console app, our users get an email with the signing link to Docusign making them remote signers.
What I want to be able to do is get those links from their emails.
I did some research and this is what each url is made of
https://demo.docusign.net/Member/EmailStart.aspx?
a=65d11cf7-d3b7-49a1-8000-6192b6227d71& <<< Unique Activity ID? Always different in all URLs
acct=a0e816ac-3919-475e-a826-34c2c33f90e7& <<< Some kind of role ID (stays same between envelopes and users of the same role, I have it
for my roles..just don't know how to get it programmatically
er=62378ec0-39ce-495e-84e4-e0e598fab3cc& <<<< envelopesApi.ListRecipients(.....) .Signers[n].RecipientIdGuid, able to get it
espei=30cec285-39cd-45a3-bb8e-7bd0560dcd80 <<<< ENVELOPE ID, able to get it
The first parameter is the main focus of my question - it is a total mistery what is it and how to get it
The second parameter looks like a role_id, but I don't know how to get it other than hard-coding values for each of my roles
The other two parameters aren't a concern.
Does anybody know how to get ahold of the first two parameters using the C# Docusign API?
Or even better, is there a way to get the recipients signing url links using the same API?
To obtain the signing URL you will have to set the recipient as an embedded recipient.
After the envelope is created, use the createRecipient:EnvelopeViews api to retrieve the Signing URL.
You have to set the recipient clientUserId parameter to mark a recipient as an embedded recipient.
Request
{
"userName": "name",
"email": "examble#email.com",
"clientUserId": "clientUserId",
"authenticationMethod": "email",
"returnUrl": "your app url"
}

Facebook messenger, testing chatbot, incorrect sender.id (data.pageEntry.messaging.event.sender.id)

Clarifying my post:
I'm setting up a facebook chatbot using the sample code. This should allow me to send messages to the chatbot (via Messenger iOS app, or via chat window at Facebook.com, app page). The expected behavior would be
Send chat message
Echo chat message
Display correct logging, no errors
However, when I send a chat message, while it correctly echoes the chat message, I am finding an error in my logging. It produces the following error message:
{ message: '(#100) No matching user found',
type: 'OAuthException',
code: 100,
fbtrace_id: 'D+PAc3ZfmLS' }
After investigation, it appears as though the app is identifying the incorrect userID for my account (app owner). It has the correct receiver ID (page ID of the application). I cannot figure out why this occurs. A copy of typical logging information is below. The incorrect sender ID is listed as "1053426944750274".
Received message for user 1053426944750274 and page 289085874757891 at 2016-07-06T20:32:31+00:00 with message: {"mid":"mid.1467837151667:954f158fd950334f60", "seq":212, "text":"marco"}
Successfully sent generic message with id mid.1467837152021:729cf052bc826dc592 to recipient 1053426944750274
Received message for user 289085874757891 and page 1053426944750274 at 2016-07-06T20:32:32+00:00 with message: {"is_echo":true,"app_id":284007785268790, "mid":"mid.1467837152021:729cf052bc826dc592", "seq":213, "text":"marco"}
Are you sure you are using the sender.id in the message recipient.id?
be aware that Facebook id is different than what you need to use when you respond to users via messenger send API.
When representing a user, these IDs are page-scoped IDs (PSID). This means that the IDs of users are unique for a given page.
If you have an existing Facebook Login integration, user IDs are app-scoped and will not work with the Messenger platform.
source

Docusign Powerforms Embed Success Status

I'm working on a PHP application that has multiple products which require signing from a customer before going for the product.
I'm using powerforms link to embed them on my application (using iFrame).
They work fine. But the problem is I need to store the document signed status in my database.
The we can set a return URL in the Docusign Preferences Page. But that will be static and I won't have a clue of what product the user has selected.
References:
Powerform Docs
You can use DocuSign Connect to receive real-time notifications of envelope events (for example, Envelope Completed). At a high-level, it works like this:
You login to DocuSign web console (as Admin) and create a Custom Connect Configuration. As part of creating this configuration, you'll specify the endpoint (http address) that you want Connect to send notifications to, and which events you want to be notified of.
You build a "listener" -- i.e., the web page that will receive the HTTP POST messages from DocuSign Connect, and process those messages.
When an Envelope or Recipient event occurs (for which you've enabled notifications in your DocuSign Connect Configuration), Connect will almost immediately send an HTTP POST to your listener. This message contains XML with info about the Envelope, Recipients, Documents, Fields, etc. You'll develop your listener such that it parses the XML message to determine Envelope status, data field values, etc. and then can respond appropriately within the context of your application (i.e., in your scenario, your listener would use the XML message from Connect to determine envelope status and which product(s) the user selected).
See this guide (http://www.docusign.com/sites/default/files/DocuSign_Connect_Service_Guide.pdf) and this page in the DocuSign Dev Center (http://www.docusign.com/developer-center/explore/connect) for more detailed information on configuring/using DocuSign Connect.
UPDATE - Using Custom Fields to populate unique Identifier for Envelope
Depending on the nature of your use case, you might need to use an "envelope custom field" to populate a unique identifier for each Envelope in the "create/send envelope" request, so that your listener application has a way of identifying the envelope when it receives a Connect message. (An 'envelope custom field' is simply a custom piece of metadata on an envelope.) Simply set the customFields property in your Create Envelope request, and populate a single textCustomFields item with the unique identifier. For example:
{
"emailSubject": "Please sign this",
"emailBlurb": "Please sign...thanks!",
"customFields": {
"textCustomFields": [
{
"value": "1234567",
"required": "false",
"show": "true",
"name": "ProductId"
}
]
},
"status": "sent"
...
}
See the REST API Guide (http://www.docusign.com/sites/default/files/REST_API_Guide_v2.pdf) for more detailed info about using Custom Envelope Fields.

Resources