microsoft not sending change notifications. Api callRecords - change-notification

I using azure function for this. If I send a post with the public URL of the function, I can't see the call ids that microsoft sends me. I only get the notification from Microsoft that it accepts the endpoint for sending change notifications but I don't see these ids. I read in other forums that calls can take a while to arrive but hours go by without sending me the caller ID. Do you know if there is anything new with this?
{
"changeType": "updated,created",
"notificationUrl": "https://subscriptions-treeam.azurewebsites.net/api/GraphNotificationHook?",
"resource": "/communications/callRecords",
"expirationDateTime": "2022-08-24T11:00:00.0000000Z",
"clientState": "secretClientState"
}
The response of MS is this
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#subscriptions/$entity",
"id": "b3x1w7db-9e71-4t91-b26g-6f5d1f502fc7",
"resource": "/communications/callRecords",
"applicationId": "9bg5x3b5-e859-2ec4-ac02-7g895f956da0",
"changeType": "created,updated",
"clientState": "secretClientState",
"notificationUrl": "https://subscriptions-treeam.azurewebsites.net/api/GraphNotificationHook?",
"notificationQueryOptions": null,
"lifecycleNotificationUrl": null,
"expirationDateTime": "2022-08-24T11:00:00Z",
"creatorId": "fr73bf06-f07a-37g9-7dde-85ee33b21tf2",
"includeResourceData": null,
"latestSupportedTlsVersion": "v1_2",
"encryptionCertificate": null,
"encryptionCertificateId": null,
"notificationUrlAppId": null
}
now, I see a lot of log but not the ID of the calls that the users of a tenan make from Microsoft teams.
Logs from function
2022-08-22T19:29:45.522 [Information] La función de activación HTTP de C# procesó una solicitud
2022-08-22T19:29:45.523 [Information] [null]
2022-08-22T19:29:45.523 [Information] Executed 'GraphNotificationHook' (Succeeded, Id=703350f0-2081-489c-99bf-be6364bdebce, Duration=1ms)
2022-08-22T19:29:45.634 [Information] Executing 'GraphNotificationHook' (Reason='This function was programmatically called via the host APIs.', Id=1c4d9739-b42d-32ff-be60-b1db1f7439f2)
i try calls from MS teams and i register the URL in the app registration
enter image description here
I don't know what I'm missing to receive notifications from microsoft teams.
the code in github here: https://github.com/wolarte/GraphNotificationHook

Related

Microsoft Graph send email api conversation Index is different

We are integrating the MS Graph API's in our c# application. sending mail is working fine by following this article Send Mail Documentation. But I am facing an issue with ConversationIndex (Mainly Threads).
ConversationIndex of mail sent via API is different than recipients' replies to the same mail. Due to this it is unable to identify the threads.
This is the payload used to send mail. can anybody help me with any key or property I am missing while sending mail?
{
"message": {
"subject": "Meet for lunch?",
"body": {
"contentType": "Text",
"content": "The new cafeteria is open."
},
"toRecipients": [
{
"emailAddress": {
"address": "fannyd#contoso.onmicrosoft.com"
}
}
],
"ccRecipients": [
{
"emailAddress": {
"address": "danas#contoso.onmicrosoft.com"
}
}
]
},
"saveToSentItems": "false"
}
Structure of Conversation Index
[reserved-1B] [timestamp-5B] [GUID-16B] [timestamp-5B][timestamp-5B]…[timestamp-5B]
<-------------Header Block---------------->​<-------------------Child Blocks------------------>
All messages part of the same conversation thread has the same 16-Bytes GUID.
5-Bytes [timestamp] in Header Block: System time when message was received converted into FILETIME format.
5-Bytes [timestamp] in Child Blocks: Child blocks are present only for Outlook messages, to indicate subsequent messages in a thread while keeping the header block attributes same. Every message reply to a conversation adds a [timestamp] at end to create a new conversationIndex.
Relative ordering of messages belonging to same conversation thread:
For all messages belonging to same GUID, SORT the messages by conversationIndex values.
Please refer to documentations here to understand better.
Tracking conversations
ConversationIndex property

Is there a way to retrieve the generated HTML email body of a dynamic template via SendGrid API call?

We have a site where our agents enter in some data, and then that data is sent to a client, via a SendGrid dynamic template.
The email content includes a lot of calculations based on the data entered, so we want our agents to have the ability to preview the email and verify the content first before sending it to the client.
Is there a way to use the SendGrid API to send a request with our json object, but instead of sending the email to the client, receive the generated email body so that we can display it to the agent and let them review it first?
Answered my own question. API v3 has GET methods for Dynamic Transactional Templates and Template Versions.
API Call:
/templates/{template_id}/versions/{version_id}
using sendgrid-ruby:
sg = SendGrid::API.new(api_key: sendgrid_api_key)
sg.client.templates._(template_id).versions._(template_version_id).get
(Note: the template_version_id is the ID and not the Name of the template version)
The response body then includes a field called html_content which is the full rendered HTML of a dynamic template version with any handlebar templating.
You can make API call via postman as:
https://api.sendgrid.com/v3/templates/d-d44fdfsdfdsfd342342343
with Bearer token along with Sendgrid API key like:
Bearer SG.Fvsdfsdjfksdfsdfjsdkjfsdfksjdfsdfksjdfkjsdkfjsdf
The response is:
{
"id": "d-d55d081558a641b48a8a1145b4549fbe",
"name": "Bt_Payment_Reminder (Active)",
"generation": "dynamic",
"updated_at": "2021-12-21 07:35:12",
"versions": [
{
"id": "a95c3652-e49f-4608-a9dd-5aa4831c2dc3",
"user_id": 11702857,
"template_id": "d-d55d081558a641b48a8a1145b4549fbe",
"active": 1,
"name": "Bt_Payment_Reminder_Updated",
"html_content": "Hello {{firstName}}",
"plain_content": "Hello {{firstName}}",
"generate_plain_content": true,
"subject": "{{subject}}",
"updated_at": "2021-12-21 07:37:48",
"editor": "code",
"test_data": "{\n \"firstName\":\"Virendra\"}",
"thumbnail_url": "sdasdasdasdasdasdsd"
}
]
}

How to change ejabberd MUC subject

I've tried to change MUC subject using ejabberd API but didn't work. I use Postman to work with the API
api : /api/change_room_option
request body :
{
"name": "testgroup",
"service": "conference.localhost",
"option": "subject",
"value": "BookNerds"
}
error : "400 Bad Request"
I've enabled change_room_option in my ejabberd.yaml and set allow_change_subj to true. Using this configuration and same request body format, I successfully change 'title' and 'description'.
Note : I ran another test using Adium and successfully change the subject. When I check in database, subject and subject_author have been updated. Do I need to set subject_author too in the request body? If yes - I don't think it's possible since change_room_option will only accept four parameters as stated here

Can someone explain, what does the webhook do in api.ai?

I am new to api.ai. I want to send data to the web server and receive it and then give it to the users? From the documentation that I read, I understood that I have to use a webhook. But I am not sure how will api.ai send and receive the data?
Can the webhook be developed in any language?
The webhook is a web service that you implement in any language and on any platform, with an HTTP (must be https for ghome) and JSON interface, that fullfils (in their lingo) a user intent.
API.AI matches a user utterance to an intent (which then suggests entity values and a response) and they pass these in the call to your web service. You do whatever processing you need - your domain logic - and then return a speech response for the user and optionally some API.AI contexts.
You can read more about it (and about slot filling fulfillment which is a little different) here.
You can visualize the working of a webhook like a block where data request comes in JSON format somewhat like this:
{
"id": "7aef9329-4a32-4d59-b661-8bf380a0f35b",
"timestamp": "2017-06-07T05:36:12.641Z",
"lang": "en",
"result": {
"source": "agent",
"resolvedQuery": "hi",
"action": "order.pizza",
"actionIncomplete": true,
"parameters": {
"address": "",
"crust": "",
"sauce": "",
"size": "",
"time": "",
"topping": "",
"type": ""
}
}
}
and another json file is returned to it according to the prescribed settings.

With this RefundTransaction operation, why is my Transaction ID invalid?

I'm trying to test refunds in the Paypal Sandbox, but I'm getting a confusing response; The transaction id is not valid.
I've managed to confirm the following:
I'm passing in the transaction ID that I get from the PAYMENTREQUEST_n_TRANSACTIONID of GetExpressCheckoutDetails.
The Transaction ID is not being modified in between getting it from GetExpressCheckoutDetails and passing it in RefundTransaction.
This happens regardless of whether or not I pass INVOICEID.
The PAYMENTACTION of DoExpressCheckoutPayment for this was Sale.
Am I making any obviously incorrect assumptions here? Does it have anything to do with this being a Sandbox order (Doubtful)? Am I getting the Transaction ID from the wrong source?
Just in case any details are needed, I'll leave the full response...
{
"TIMESTAMP": "2014-01-06T18:15:35Z",
"CORRELATIONID": "cb90afac455c",
"ACK": "Failure",
"VERSION": "109",
"BUILD": "9138168",
"L_ERRORCODE0": "10004",
"L_SHORTMESSAGE0": "Transaction refused because of an invalid argument. See
additional error messages for details.",
"L_LONGMESSAGE0": "The transaction id is not valid",
"L_SEVERITYCODE0": "Error",
"REFUNDSTATUS": "None",
"PENDINGREASON": "None"
}
And the fields/values of the RefundTransaction call itself... (Redacting credentials even though it's sandbox)
{
"METHOD": "RefundTransaction",
"TRANSACTIONID": "30888131YM063371A",
"USER": "[redacted]",
"REFUNDTYPE": "Partial",
"CURRENCYCODE": "USD",
"REFUNDSOURCE": "any",
"AMT": 57.21,
"PWD": "[redacted]",
"SIGNATURE": "[redacted]",
"VERSION": 109
}
EDIT: (May post as an answer if Robert doesn't update his answer after a while, since he deserves credit for this)
PayPal_Robert noted that in my SetExpressCheckout call, I was setting the recipient to the actual account that payments would be going to with the live API when - since this is Sandbox - I should have been sending it to the -facilitator account.
I can't find any transactions with that transactionID in the sandbox environment - across all accounts either. I suspect it's getting mangled somewhere.
The only thing I found for the same API caller is an order with transactionID O-072365850X147461B, created on the 2nd of January.
Can you re-create the entire flow, including creating a fresh transaction and try with that?
If you still run into issues, please file a ticket with us at https://paypal.com/mts (24x7) or shoot me an email (address in profile, I only work GMT however.)