Cakephp 2.x get message { "name": "The request has been black-holed", "url": "\/rest_sms_boxs.json" } in Restfull api - rest

I write a controller and it contain multi POST action but whene i post data to these actions my response is :
{ "name": "The request has been black-holed", "url": "/rest_sms_boxs.json" }
Now how can i resolve this problem.

Certainly the security mode.
Try in your controller:
public function beforeFilter()
{
parent::beforeFilter();
$this->Security->unlockedActions = array('your_method');
}

Related

Clickatell One API Customer Call Back not returning anything

I have developed a call back REST service using the following link as reference https://docs.clickatell.com/channels/one-api/one-api-reference/#tag/One-API-Client-Callbacks/operation/sendPostOmniReplyCallback. I am using the sample payload as supplied by the Clickatell example using Postman and I can process and post the payload without problems. It also works when I deploy this as a public URL on the web. However, when pasting my URL in the Clickatell Customer Call Back I do not receive any call backs. I am obviously missing something or misinterpreting the sample code provided by Clickatell. Please note that for testing purposes I write the full payload to MySQL - works when using Postman, but not from Clickatell Call Back URL.
enter code here
{
[Route("client-callback/one-api-reply")]
[ApiController]
public class MessageController : ControllerBase
{
[HttpPost]
public async Task<dynamic> StartProcessiongAsync([FromBody] dynamic obj)
{
string myObj = JsonConvert.SerializeObject(obj);
var data = JsonConvert.DeserializeObject<Rootobject>(myObj);
var context = new DataContext();
var command = context.Database.GetDbConnection().CreateCommand();
context.Database.OpenConnection();
command = context.Database.GetDbConnection().CreateCommand();
{
command.CommandText =
"INSERT INTO testcallback(message) VALUES ('" + myObj + "');";
command.ExecuteNonQuery();
}
return Ok(obj);
}
}
}
Postman Payload Sample
{
"integrationId": "fa8090815f05d5ed015f0b5b56080cd2",
"integrationName": "My integration",
"event": {
"moText": [
{
"channel": "sms",
"messageId": "3a89680503414383af44dcd0e4e5f184",
"relatedMessageId": "d33eef0838a121f71069a4cc8d55c19e",
"relatedClientMessageId": "d33eef0838a121f71069a4cc8d55c19e",
"from": "2799900001",
"to": "2799900001",
"timestamp": 1506607698000,
"content": "Text Content of the reply message",
"charset": "UTF-8",
"sms": {
"network": "Network ID"
},

Asking while using SSML in Dialogflow webhook

I am trying to build an Actions on Google Agent via DialogFlow and keep getting errors when trying to ask the user a question while including ssml.
I have built the agent on DialogFlow, have logic implemented using the fulfillment webhook (implemented via the node module dialogflow-fulfillment) and have been able to test on DialogFlow successfully using the test console on the right side DialogFlow.
I therefore hooked up the DialogFlow Integrations to Google Assistant.
I first tried unsuccessfully:
const client = new WebhookClient({ req, res });
let qToSnd = 'Hi <break time=\"500ms\"/> Can I help you?';
let conv = client.conv();
conv.ask(qToSnd);
client.add(conv);
The above would work (not give errors) but would result in the question being asked while speaking out the <break> tag.
I have also tried:
conv.ask(
new Text({
text: _stripTags(qToSnd),
ssml: qToSnd
}));
However, when I test this using the Actions on Google simulator I get the error message:
[Agent] isn't responding right now. Try again soon.
Digging into the logs viewer shows the following error message:
MalformedResponse: ErrorId: ... Failed to parse Dialogflow response into AppResponse because of invalid platform response. : Could not find a RichResponse or SystemIntent in the platform response for agentId: ... and intentId: ...
My fulfillment API is returning:
{
"payload": {
"google": {
"expectUserResponse": true,
"richResponse": {
"items": [
{
"text": "Hi - Can I help you?",
"ssml": "Hi <break time=\"500ms\"/> Can I help you?"
}
]
}
}
}
}
I will appreciate any pointers in the right direction.
Looking at the JSON snippet for a simple response in the documentation, you should wrap your item in a simpleResponse element. Additionally, the keys you are using for text and audio responses are incorrect, and should be textToSpeech and displayText.
{
"payload": {
"google": {
"expectUserResponse": true,
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "Howdy, this is GeekNum. I can tell you fun facts about almost any number, my favorite is 42. What number do you have in mind?",
"displayText": "Howdy! I can tell you fun facts about almost any number. What do you have in mind?"
}
}
]
}
}
}
}
Inspired by #NickFelker's answer below and researching more into this topic, I was able to get the SSML working by making sure to add the <speak> tags. So this works:
const client = new WebhookClient({ req, res });
let qToSnd = 'Hi <break time=\"500ms\"/> Can I help you?';
let conv = client.conv();
conv.ask('<speak>' + qToSnd + '</speak>');
client.add(conv);
The fulfillment API returns:
{
"payload": {
"google": {
"expectUserResponse": true,
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "<speak>Hi <break time=\"500ms\"/> Can I help you</speak>"
}
}
]
}
}
}
}

Can a Facebook page message a user without the user first sending a message to the page?

I'm wanting to set up an app for a page(or possibly group) where if a user comments on the page then the page will send the user a private message. So far I'm finding this to be impossible, I'm trying to make the following call via postman:
POST https://graph.facebook.com/v3.2/me/messages
{
"recipient": {
"id": "{receipientId}"
},
"message": {
"text": "hello, world!"
}
}
The error message I'm getting back is:
{
"error": {
"message": "(#551) This person isn't available right now.",
"type": "OAuthException",
"code": 551,
"error_subcode": 1545041,
"fbtrace_id": "{fbtrace_id}"
}
}
I've seen this functionality with another app and I can't seem to find the documentation anywhere that allows this type of behavior, any assistance would be greatly appreciated.
Edit: The recipient id is coming from a page scoped user id.
Ok through more reading I was able to find the answer. Private replies are how to do this.
Send a post to this endpoint:
https://graph.facebook.com/v3.2/{CommentId}/private_replies
{
"message": "Hello, world"
}
Documentation: https://developers.facebook.com/docs/graph-api/reference/v3.2/object/private_replies

How can i consume HAPI Structure from my spring-boot application

I would like to use the HAPI FHIR structures in my application. My application is a spring-boot application.
Code:
#RequestMapping(value = "{fhirVersion}/$transaction", method = RequestMethod.POST)
public String execute(#RequestBody Bundle bundle,#PathVariable String fhirVersion) {
return "";
}
Error:
{
"timestamp": "2018-04-03T15:06:51.279+0000",
"status": 415,
"error": "Unsupported Media Type",
"message": "Content type 'application/json;charset=UTF-8' not supported",
"path": "/dstu3/$transaction"
}
Could you please let me know how this could be achieved?
Thanks

How to delete facebook post programmatically that has not been posted by your application?

How to delete Facebook post that is not posted by your application?
Using graph API - according to docs
/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/{post-id}",
null,
HttpMethod.DELETE,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
} ).executeAsync();
Above code is not working.
It is giving error:-
{
"error": {
"message": "(#200) This post wasn't created by the application",
"type": "OAuthException",
"code": 200,
}
}
Or does there exist some other method?
According to the Graph API reference:
An app can delete any post it published, or a page-management app can delete a Post published to a Page that the app manages.
So it depends on what you are doing.