MobileFirst create wrong SMS request - sms

IBM MobileFirst Platform Foundation 8.0.0.
After configuring SMS settings I am trying to send a message but the request is created in the wrong way. See the result below.
//REST API : send notification request
{
"message": {
"alert": "Hello World from an SMS message"
},
"notificationType":3,
"target" : {
"deviceIds" : ["9a149c24-8859-3383-6067-d161e46d2554"]
}
}
The created request:
473607:[2017-01-02 16:44:02.494] - [440093822] Request received: HTTP GET /send.aspx?
encode=false&name=toParamName&value=Recipients&encode=false&name=textParamName&value=MessageText&encode=false&name=MessageType&value=text&encode=false&name=SenderName&value=PLIX&encode=false&name=UserName&value=MahmoudSamy&encode=true&name=Password&value=xyz&to=20100051111&text=Hello+World+from+an+SMS+message+2
//SMS settings
{
"port": "80",
"programName": "/sendsms",
"host": "xyz.com",
"name": "SMSGateway",
"parameters": [
{
"encode": "false",
"name": "toParamName",
"value": "to"
},
{
"encode": "false",
"name": "textParamName",
"value": "text"
},
{
"encode": "false",
"name": "SenderName",
"value": "Support"
},
{
"encode": "false",
"name": "UserName",
"value": "xyz"
},
{
"encode": "false",
"name": "Password",
"value": "xyz"
}
]
}

We tried to send SMS with SMS settings shared by you.
We are able to get correct value pair in the created request.
Below is the created request
GET /gateway/add.php?encode=false&name=toParamName&value=to&encode=false&name=textParamName&value=text&encode=false&name=SenderName&value=Support&encode=false&name=UserName&value=xyz&encode=false&name=Password&value=xyz&to=99&text=Hello+World+from+an+SMS+message HTTP/1.1
Also in created request shared by you, I am noticing different username value than given in sms settings.
Could you please tell us how you are checking the request. We are using wireshark to capture.

the below configuration works with me but it force me to accept to and text parameters.
{
"port": "80",
"programName": "/sendsms",
"host": "xyz.com",
"name": "SMSGateway",
"parameters": [{
"SenderName": "Support",
"MessageType": "text",
"UserName": "xyz",
"Password": "xyz"
}]
}
HTTP GET /send.aspx?SenderName=Support&MessageType=text&UserName=xyz&Password=xyz&to=083127312763&to=hello+world

Related

Access control at property level (hiding/showing properties in api response based on the role)

I have a spring-boot based micro-service generated using JHipster.
I am using keycloak as my Auth Server. I could enable Role-based & scope based authorization on my resources(apis).
Now the requirement is: based on the role of the client, I need to restrict the information to send in the response (either mask the attributes or nullify them).
eg:
consider the following api to get the person's profile
/api/person/{id}
{
"name": {
"firstName": "Jack",
"lastName": "Sparrow"
},
"gender": "MALE",
"emails": {
"details": [
{
"emailId": "jack.sparrow#gmail.com"
}
]
},
"phones": {
"details": [
{
"phoneNumber": "1234567890",
"countryCode": "+1"
}
]
},
"addresses": {
"details": [
{
"addressLine1": "aaaaaaaa",
"addressLine2": "bbbbbbb",
"city": "cccccc",
"state": "ddddd",
"country": "South Africa",
"postalCode": "987654"
}
]
},
"photo": "string",
"nationality": "South Africa",
"countryOfResidence": "string",
"active": true,
"createdAt": 1537431339569,
"modifiedAt": 1537436600693,
"createdBy": "admin",
"modifiedBy": "admin"
}
Now, when a person with BASIC role calls this API, the requirement is to show only basic information like:
- name, gender
If he has INTERMEDIATE role then we can send something more than basic but not full information. eg: name, gender, photo, nationality
If he has ADMIN role then we can send the complete information.
Can anyone please let me know What is the best approach to achieve this.
-- Thanks in advance :)

What is the Json response we should send to microsoft botFramework to route my response to telegram channel

I am sending below response to the service url provided by botFramework request https://telegram.botframework.com/v3/conversations/-263387177/activities/
My intent is that using sendMessage method of telegram I am able to route a text to the telegram channel via microsoft botframework
The http post which I am sending is as below
{
"type": "message",
"locale": "en-Us",
"chat_id":-263387177,
"channelID":"telegram",
"from": {
"id": "GTSFIBot",
"name": "sapeops"
},
"text":"hi , Greetings!",
"replyToId": "1505813737353",
"recipient": {
"id": "DirectLineClient"
},
"conversation": {
"isGroup": true,
"id": "-263387177",
"name": "sapeops group"
},
"channelData": {
"method": "sendMessage",
"parameters": {
"chat_id": -263387177,
"parse_mode": "HTML",
"text": "<B>Greetings! How are you doing?</B>"
},
"chat": {
"id": -263387177,
"title": "sapeops group",
"type": "group",
"all_members_are_administrators": true
}
}
}
I get 502 bad gateway response and a below JSON.
{
"error": {
"code": "ServiceError",
"message": "Telegram API returned a result code indicating non-success"
}
}

Can't get almost all information from event from service Hook

I am trying to use the Trello service hook with Team Foundation Server. I have followed this tutorial and the connection worked without problems but, I can't get the informations I need from the Event JSON:
The Description I Tried
This is the Event JSON:
{
"id": "03c164c2-8912-4d5e-8009-3707d5f83734",
"eventType": "git.push",
"publisherId": "tfs",
"scope": 0,
"message": {
"text": "Jamal Hartnett pushed updates to Fabrikam-Fiber-Git:master.",
"html": "Jamal Hartnett pushed updates to Fabrikam-Fiber-Git:master.",
"markdown": "Jamal Hartnett pushed updates to `Fabrikam-Fiber-Git`:`master`."
},
"detailedMessage": {
"text": "Jamal Hartnett pushed a commit to Fabrikam-Fiber-Git:master.\n - Fixed bug in web.config file 33b55f7c",
"html": "Jamal Hartnett pushed a commit to Fabrikam-Fiber-Git:master.\n<ul>\n<li>Fixed bug in web.config file 33b55f7c\n</ul>",
"markdown": "Jamal Hartnett pushed a commit to [Fabrikam-Fiber-Git](https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_git/Fabrikam-Fiber-Git/):[master](https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_git/Fabrikam-Fiber-Git/#version=GBmaster).\n* Fixed bug in web.config file [33b55f7c](https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_git/Fabrikam-Fiber-Git/commit/33b55f7cb7e7e245323987634f960cf4a6e6bc74)"
},
"resource": {
"commits": [
{
"commitId": "33b55f7cb7e7e245323987634f960cf4a6e6bc74",
"author": {
"name": "Jamal Hartnett",
"email": "fabrikamfiber4#hotmail.com",
"date": "2015-02-25T19:01:00Z"
},
"committer": {
"name": "Jamal Hartnett",
"email": "fabrikamfiber4#hotmail.com",
"date": "2015-02-25T19:01:00Z"
},
"comment": "Fixed bug in web.config file",
"url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_git/Fabrikam-Fiber-Git/commit/33b55f7cb7e7e245323987634f960cf4a6e6bc74"
}
],
"refUpdates": [
{
"name": "refs/heads/master",
"oldObjectId": "aad331d8d3b131fa9ae03cf5e53965b51942618a",
"newObjectId": "33b55f7cb7e7e245323987634f960cf4a6e6bc74"
}
],
"repository": {
"id": "278d5cd2-584d-4b63-824a-2ba458937249",
"name": "Fabrikam-Fiber-Git",
"url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249",
"project": {
"id": "6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c",
"name": "Fabrikam-Fiber-Git",
"url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/projects/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c",
"state": "wellFormed",
"visibility": "unchanged"
},
"defaultBranch": "refs/heads/master",
"remoteUrl": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_git/Fabrikam-Fiber-Git"
},
"pushedBy": {
"id": "00067FFED5C7AF52#Live.com",
"displayName": "Jamal Hartnett",
"uniqueName": "Windows Live ID\\fabrikamfiber4#hotmail.com"
},
"pushId": 14,
"date": "2014-05-02T19:17:13.3309587Z",
"url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249/pushes/14"
},
"resourceVersion": "1.0",
"resourceContainers": {
"collection": {
"id": "c12d0eb8-e382-443b-9f9c-c52cba5014c2"
},
"account": {
"id": "f844ec47-a9db-4511-8281-8b63f4eaf94e"
},
"project": {
"id": "be9b3917-87e6-42a4-a549-2bc06a7a878f"
}
},
"createdDate": "2017-07-21T16:48:44.312Z"
}
This is the Request that was send to Trello:
Method: POST
URI: https://api.trello.com/1/cards?key=7d6630fd03ac2b6fc9fde2f2ef0c4096&token=********
HTTP Version: 1.1
Headers:
{
Content-Type: application/json; charset=utf-8
}
Content:
{
"name": "Test NÂș ",
"desc": "Description: ",
"pos": "top",
"due": null,
"labels": "green",
"idList": "5935a0d45ff8e5a6c8f828b9"
}
The only field that I could get/read from the Event JSON was the "message".
What am I doing wrong?
If you want to get the push ID and comments, the description is:
{{push.pushId}}
{{push.commits[0].comment}}
Update
Eddie is right you should use push as the resource in this case. The docs are not so clear. In the end, it was something so simple. However the corresponding checkin is not work for Code checked in event.
The docs could definitely be more clear in how the resource are for each event which applied to help avoid this confusion.
The basic form of the placeholder is {{resource.field}} where
resource is the name of the resource raising the event (workitem, build, etc) and field is a field within the resource section of the
event, like id. So, if the subscription were for a completed build,
it might be something like:
Build {{build.id}} completed at {{build.finishTime}}
Seems the issue is you are using the wrong placeholder in this case. According to your send Request , resource.pushID & resource.commits.[0].comment is not replaced by values from the event that was raised.

Skype Bot Rest API Conversation ID

So I used an account and message my skype bot.
I get this json response on my endpoint url. I sent a text "add"
{"text":"add"
,"type":"message"
,"timestamp":"2017-01-13T15:38:32.242Z"
,"id":"1234567"
,"channelId":"skype"
,"serviceUrl":"https:\/\/smba.trafficmanager.net\/apis\/"
,"from":{"id":"29:yyyy","name":"Real Person"}
,"conversation":{"id":"29:yyyy"}
,"recipient":{"id":"28:xxxx","name":"Skype Test"}
}
When I return a reponse to this url using yyyy as conversationId
POST /v3/directline/conversations/{conversationId}/activities
https://directline.botframework.com/v3/directline/conversations/yyyy/activities
with this parameter:
{
"type": "message",
"text": "registration",
"from": {
"id":"xxxx","name":"Skype Test"
},
"recipient": {"id":"yyyy","name":"Real Person"}
}
I get an unknown conversation response. Not sure what is wrong.
Your Response should look like:
{
"type": "message",
"from": {
"id": "recipient_id",
"name": "recipient_name"
},
"conversation": {
"id": "conversation_id",
"name": "conversation_name(if available)"
},
"recipient": {
"id": "from_id",
"name": "from_name"
},
"text": "response_text",
"replyToId": "activity_id"
}
Hope that Help :)

IBM Social Business Toolkit getContacts API Fails With 403 Forbidden

I used to be able to use the IBM SBT getContacts API from either a perl script (with authentication provided in the request) or an internet browser (authentication popup would appear) and it would return the data in JSON format as documented on the IBM Connections Developers API reference page:
http://www-10.lotus.com/ldd/appdevwiki.nsf/xpAPIViewer.xsp?lookupName=API+Reference#action=openDocument&res_title=Contacts_getContacts_API&content=apicontent&sa=true
Recently, however, the API call has been returning a 403 forbidden status. If I sign in to the IBM Connections Cloud before trying to use the API via a browser, it is converted to:
https://apps.na.collabserv.com/mycontacts/home.html
Does anyone know what I need to do to get the API to work again?
Thanks.
The best API to use are
https://apps.na.collabserv.com/lotuslive-shindig-server/social/rest/people/#me/#all?filterBy=type&filterOp=equals&filterValue=contacts&format=json
You'll get a list of the following entries back...
{
"photos":
[
],
"telephone": "",
"profileUrl": "",
"mobilephone": "",
"orgs":
[
{
"value": "CONTACTS",
"type": "Source"
},
{
"value": "Mentorship Expressway",
"type": "Org"
}
],
"website": "",
"id": "na.collabserv.com:contact:160000909070",
"fax": "",
"connectedToId": 201238541234,
"addresses":
[
],
"emailAddress": "asdfasdf#us.ibm.com",
"websites":
[
],
"objectId": 160000909070,
"type": "FRIEND",
"jobtitle": "",
"updated": "2014-07-01T16:44:21.000Z",
"ims":
[
],
"emails":
[
{
"value": "CONTACTS",
"type": "Source"
},
{
"title": "Primary Email",
"email": "asdfasdf#us.ibm.com"
}
],
"org":
{
"name": "Mentorship Expressway"
},
"displayName": "asdfasdf",
"address": "",
"companyId": 22285,
"phoneNumbers":
[
{
"value": "CONTACTS",
"type": "Source"
},
{
"title": "MOBILE",
"phone": "+ asdfasdf"
}
]
}

Resources