I have tried to rin the xtify simple push api in post manbut it shows error. I have used the following json code in raw body:
{
"apiKey":"12345678-7d94-415a-9eed-00987654321",
"appKey":"12345678-4ab7-4633-8a7c-00987654321",
"sendAll": true,
"content": {
"message": "Arma virumque cano, troiaeque primus ab oris",
"sound": "default.caf",
"badge": "+1",
"action": {
"type": "CUSTOM",
"label":"Open",
"data": "{'action_id': 'ABC', inum: '123456'}"
}
}
}
I have valid api key and app key. I have changed here the api key and app key for security reason. Using header Content-Type=application/json but it shows the error message:
Invalid Application Key
Actually I have used this url https://api.xtify.com/2.0/push for sending push. But it should be like this https://euapi.xtify.com/2.0/push. It works now
Related
Facing issue to send proactive message to the end user (msteams), via bot service,
I try using the bot framework python SDK, where I am getting the following error even for getting conversation id.
botbuilder.schema._models_py3.ErrorResponseException: Operation returned an invalid status code 'Unauthorized'
Hence I try to simulate calls via postman and rest API's, in here I am able to get conversation id successfully, but if I try to use that conversation id to further send a message via activities I am not able to do it. following is rest endpoint and payload. In here I am getting an error of incorrect payload.
https://smba.trafficmanager.net/apis/v3/conversations/8:orgid:949a3f72-b82c-4b89-b2de-9defbe6ae7cd/activities
{
"type": "message",
"recipient": {
"id": "29:1ZcsKdk0rsLmsywvI2SNQ2J7OIz"
},
"from": "bot",
"channelData": {
"notification": {
"alert": "true"
}
},
"text": "Hello world"
}
There was an issue with payload, I added BOT_ID along with name and able to successfully post message to end user. Following is working payload.
Payload:
{ "type":"message",
"recipient":{
"id":"29:1dUxQXVlH6QGByu1T9MR4p5g0c5URMaBtKqGU74C3zdowO78nPbuu2dg- qj9o02OkJ4MYXt2I-nxDgf9ga9EY5w"
},
"from":{
"id":"28:d7afe8c9-f0cd-434f-8906-be2b744229ac",
"name":"bot"
},
"channelData":{
"notification":{
"alert":"true"
}
},
"text":"Hello "
}
I have:
An JavaScript Azure Function in an HTTP webhook configuration; the Function provides a URL; the Function performs an action
A webhook configured in the software I hope to receive notifications from
An Azure Logic App with an HTTP/webhook step that provides a URL for the webhook notification to go to
My goal is that the Azure Function's URL receives notifications from the software's webhook and performs an action. The Azure Logic App is for testing only.
What works
When the the Azure Logic App's URL is used in the software's webhook configuration, the desired action is performed. All works as expected.
The Azure Logic App's logging shows the JSON output from the incoming webhook. I expect (but believe this may be where I am going wrong) that this is the JSON the webhook is sending to the Azure Logic App's URL. When this JSON is used in the Azure Function UI's "Test" tab > "Request body" field, the desired action is performed. All works as expected.
When the Azure Function's URL and the JSON is in a Postman request, the desired action is performed. All works as expected.
What doesn't work
When the Azure Function's URL is used in the software's webhook configuration, no action is performed. This is of course my goal. From everything I have read, I understand that this URL as a webhook endpoint should work.
Azure Function's URL
This is from Get function URL > default (Function key).
https://<app_name>.azurewebsites.net/api/content?code=<api_key>
Other Azure Function config settings
Allowed HTTP methods: GET, POST
Authorization level: Function
The JSON I believe to be coming over the webhook
{
"headers": {
"Expect": "100-continue",
"Host": "redacted",
"X-Telligent-Webhook-Sender": "redacted",
"Content-Length": "16908",
"Content-Type": "application/json; charset=utf-8"
},
"body": {
"events": [{
"TypeId": "ec9da4f4-0703-4029-b01e-7ca9c9ed6c85",
"DateOccurred": "2018-12-17T22:55:37.7846546Z",
"EventData": {
"ActorUserId": 9999,
"ContentId": "redacted",
"ContentTypeId": "redacted",
"ForumReplyId": 9999,
"ForumThreadId": 9999,
"ForumId": 9999
}
}]
}
}
I also tried with the following test code for the same results. It aligns more closely with the sample payload data provided by the software company:
What I tried
{
"events": [{
"TypeId": "ec9da4f4-0703-4029-b01e-7ca9c9ed6c85",
"DateOccurred": "2018-12-17T22:55:37.7846546Z",
"EventData": {
"ActorUserId": 9999,
"ContentId": "redacted",
"ContentTypeId": "redacted",
"ForumReplyId": 9999,
"ForumThreadId": 9999,
"ForumId": 9999
}
}]
}
Sample payload data
{
"events": [
{
"TypeId": "407ad3bc-8269-493e-ac56-9127656527df",
"DateOccurred": "2015-12-04T16:31:55.5383926Z",
"EventData": {
"ActorUserId": 2100,
"ContentId": "4c792b81-6f09-4a45-be8c-476198ba47be"
}
},
{
"TypeId": "3b75c5b9-4705-4a97-93f5-a4941dc69bc9",
"DateOccurred": "2015-12-04T16:48:03.7343926Z",
"EventData": {
"ActorUserId": 2100,
"ContentId": "4c792b81-6f09-4a45-be8c-476198ba47be"
}
}
]
}
I do not know how to determine why the Azure Function is not triggered by the webhook. The software's API documentation does not seem to provide a way to look at the JSON being sent over the webhook, although in my inexperience I may be wrong.
Is there a mechanism within Azure, or Postman, or another tool that lets me see what JSON is being sent over the webhook? Or perhaps is there another approach to determining the cause of the issue?
Thank you for any help.
This is how I got the JSON file from Azure alerts.
Install Ruby on the server
Install Sinatra with following command gem install sinatra
Create file webhook.rb and paste code bellow
require 'sinatra'
set :port, 80
set :bind, '0.0.0.0'
post '/event' do
status 204 #successful request with no body content
request.body.rewind
request_payload = JSON.parse(request.body.read)
#append the payload to a file
File.open("events.txt", "a") do |f|
f.puts(request_payload)
end
end
Run the web service with command ruby webhook.rb
JSON fill be written to file events.txt
I have deployed the sample code for Chrome push notifications and updated the gcm_sender_id to a newly configured project, the client is able to subscribe/unsubscribe without issue but when posting a request to send a notification the response MismatchSenderId is continually returned.
I have tried creating multiple new projects console.firebase.google.com, but nothing seems to work.
Request:
POST /gcm/send HTTP/1.1
Host: android.googleapis.com
Authorization: key=<Server Key/>
Content-Type: application/json
{
"registration_ids":[
"<Registration-ID/>"
]
}
Response:
{
"multicast_id": 6881038306061588882,
"success": 0,
"failure": 1,
"canonical_ids": 0,
"results": [
{
"error": "MismatchSenderId"
}
]
}
I am using the 'Server Key' as the request auth token (which works as 401 is returned when an invalid key is used) and am using the 'Sender ID' in the manifest:
manifest.json
{
"name": "Notification Demo",
"gcm_sender_id": "<Sender ID/>"
}
This was my own fault; the sample registration ID's were in a different format to the generated ones I was seeing and did not contain semicolons which I was using to strip the registration ID from the subscription endpoint string. Splitting the endpoint by a forward slash and taking the last instance returned the correct Registration ID which works fine.
I'm trying to set up a sign-on process for an internal company web app using the Azure AD and Microsoft Graph. I want to manage security groups in the AD, so when a user signs in via OAuth, I'm doing a GET request to https://graph.microsoft.com/v1.0/me/memberOf to see which groups the signed-in user is in. The user has the appropriate scopes to see this information, and it works in the Graph Explorer, but when I make the call in my PHP application, I get a malformed JSON response:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#directoryObjects",
"value": [{
"#odata.type": "#microsoft.graph.group",
"objectType": "Group",
"objectId": "blahblah2",
"deletionTimestamp": null,
"description": "Users who have access to my web app's administration",
"dirSyncEnabled": null,
"displayName": "Web App Administrators",
"lastDirSyncTime": null,
"mail": null,
"mailNickname": "blahblah2",
"mailEnabled": false,
"onPremisesSecurityIdentifier": null {
"error": {
"code": "InternalServerError",
"message": "Unsupported extension property type.",
"innerError": {
"request-id": "blahblah3",
"date": "2016-02-29T09:42:18"
}
}
}
...and that's all I get!
The documentation at https://msdn.microsoft.com/en-us/library/azure/ad/graph/api/entity-and-complex-type-reference#GroupEntity says that this onPremisesSecurityIdentifier field is something to do with on-premesis sync, but i've never used that.
Your request had api-version query parameter appended (i.e. /v1.0/me/memberOf?api-version=1.6). Please remove that query parameter. Microsoft Graph identifies the API version by the first segment in the URL path, e.g. https://graph.microsoft.com/v1.0/me/memberOf or https://graph.microsoft.com/beta/me/memberOf
I have a PUT API Gateway endpoint which should be used to update a DynamoDB entry.
The id for that DynamoDB entry is given as the path parameter.
I have the following mapping template:
"application/json": {
"id": "$input.params('id')",
"title": "$input.json('$.title')"
}
The id is returned as expected.
If I submit this request body
{
"title": "Hello world"
}
I get the error Could not parse request body into json: Unexpected character (\'t\'
Here's the overview of my AWS management console:
what am I missing?
So I just found the solution:
"title": "$input.json('$.title')"
should be
"title": $input.json('$.title') (without the double quotes).
Source: http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html#input-variable-reference