role (h) does not exist on document cudasign error - php

I'm using cudasign api to send a document and get it signed.
The document is being sent, and I successfully put a field on it with role "Buyer", but when I send the invite for that document it gives an error like the following
{"errors":[{"code":65536,"message":"role (h) does not exist on document"}]}
I've given same role(buyer) to the recipient, but it still gives the same error. Can anyone tell me what's wrong with my code?
array("to" => array("email" =>$to,
"role"=>"Buyer",
"order"=>1,
"role_id"=>""),"from" => $from,"cc"=>[],
"subject"=>$from." needs Your Signature",
"message"=>$from."invited you to sign")

after a lot of help with their support, we resolved this issue, the to array should be in a single array, like,
array("to" => array(array("email" =>$to,
"role"=>"Buyer",
"order"=>1,
"role_id"=>"")),"from" => $from,"cc"=>[],
"subject"=>$from." needs Your Signature",
"message"=>$from."invited you to sign")

Related

Mailchimp API (3.0.75 for PHP) invalid resource issue on updateListMemberTags

I have a situation where I am importing lists of people from a CRM and then assigning a tag to help group them in Mailchimp. The importing works no problem, but I get an Invalid Resource error when I try to add the tag using this code:
$response_updateListMemberTags = $mailchimp->lists->updateListMemberTags("91ca711dd8", md5($row->Eaddress_HH_A1_A2), [
"tags" => [
["name" => $iListID, "status" => "active"]
]);
The Guzzle exception message is
Invalid Resource - The resource submitted could not be validated.
The super odd thing is that if I output the above to the screen, and then copy and paste that output into the code to run, it works. I just can't wrap my brain around it. Thoughts?

Determining if and possibly retrieving a Twilio incoming MMS attachment that has an unsupported content type

Using the Twilio PHP API, I'm trying to account for unsupported attachments (specifically "text/x-vCard", as sent by Android/Google Fi). When I receive the $_POST vars in my code, they look something like this:
Array
(
[ToCountry] => US
[ToState] => NJ
[SmsMessageSid] => <sms-message-id>
[NumMedia] => 0
[ToCity] => MERCHANTVILLE
[FromZip] => 08401
[SmsSid] => <sms-sid>
[FromState] => NJ
[SmsStatus] => received
[FromCity] => <from-city>
[Body] => This is the body of the message.
[FromCountry] => US
[To] => +xxxxxxxxxxx
[ToZip] => xxxxx
[AddOns] => {"status":"successful","message":null,"code":null,"results":{}}
[NumSegments] => 1
[MessageSid] => <message-sid>
[AccountSid] => <account-sid>
[From] => +xxxxxxxxxxx
[ApiVersion] => 2010-04-01
)
As you can see, there is no evidence of any error or warning that an unsupported file type has been sent. I need to either
Reply to the sender that the attachment is unsupported, or
Find the saved attachment on Twilio and forward it.
I suspect that the attachment IS saved on Twilio, because when I use the $twilio->messages('xxxxxxxxxxxxxxxx')->fetch(), I get a whole lot more info, including:
[subresourceUris] => Array (
[media] => /2010-04-01/Accounts/xxxxxxxxxxxxxxxx/Messages/xxxxxxxxxxxxxxx/Media.json
))
I don't see a documented way to retrieve the resource using PHP, so I'm stuck. I've tried:
$media = $twilio->messages("MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
->media("MEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
->fetch();
This returns some items, but they are similar to the ->fetch() return and I don't see anything that will help me download or read the media.
So after working with Twilio tech support for two weeks, I've learned that Twilio simply drops an attachment with an unsupported mime type.
As to how to get alerted to the error, there is no documented way that I could find from the Twilio docs or working with tech support, but I found a work-around that seems to do the job for now. Here's what I do:
Twilio sends me the incoming message to incoming.php on my server.
I get the attachment count using $_POST['NumMedia'].
Using $_POST['SmsMessageSid'], I query Twilio to retrieve the message stored on the server:
$msg = $client->messages($_POST['SmsMessageSid'])->fetch();
I check the $msg->numMedia value. If it's greater than the $_POST['NumMedia'] value, I know an attachment has been dropped.
If the numbers don't match, I shoot off a reply text to the sender letting them know an attachment was dropped.
I've asked Twilio support to send a note to the developers to add x-vcard as a supported type, since a LARGE number of Android phones still use it.
Thank you to #philnash for help with the problem.

sending message to slack channel using PHP/Guzzle prints "Array"

I'm trying to post to a Slack channel but it's not working as intended.
The only message I get in Slack says Array, as in that the value of text is an Array. As I'm understanding their docs, it shouldn't do that. If I move the text to the first level of the array, the actual text is displayed, so I'm guessing that my request is working fine. What am I missing? This is being done in PHP with GuzzleHttpClient.
My message:
[
'type' => 'section',
'text' => [
'type' => 'mrkdwn',
'text' => 'This is supposed to be my text'
]
];
My request to the API:
$request = $client->post($url, [
RequestOptions::JSON => $messages
]);
It seems not as obvious, but you cannot use the message formatting used for their API chat.postMessage for incoming webhooks. Both have different formatting.
With that said, follow this documentation for webhook messages and it's respective formatting here.
What you were trying to do is use so called "blocks" which seems to be dedicated to their API messaging instead.
If you try your message on this message builder (which is intended for webhooks), it will fail. But it will work on this message builder.
Perhaps you can get away with using new-lines if you want your message to appear over multiple lines. See here.
As #ncla mentioned, if you are using "Block UI" elements, using the incoming webhook API, you cant send the blocks as with the chat.postMessage.
Its not obvious on the Blocks documentation, but in the
Messages payload page it specifies that you can send a blocks attribute. This will allow you to use the Blocks structure.
Your structure is incorrect, see documentation: https://api.slack.com/messaging/composing/layouts#stack-of-blocks
It should be array of message blocks, you need to nest it further one time.
[
[
'type' => 'section',
'text' => [
'type' => 'mrkdwn',
'text' => 'This is supposed to be my text'
]
]
];

ALL GCM parameters?

i´ve written a "pushserver" for my app via PHP.
The push notifications i´ve sent via PHP are all received on the device, so far.
But, i can just send/set the "message" and "title", see:
$fields = array(
'registration_ids' => $registrationIDs,
'data' => array(
'message' => $message,
'title' => 'My App',
'vibrate' => 1,
'sound' => 1,
'icon' => "http://example.com/image.jpg",
"style" => "inbox"
),
);
"icon" and "style" are not working (vibrate and sound not tested, yet).
Every link for the parameters i´ve found is broken or kind of "you need to do object.setSomething() in JAVA.
Is there a list anywhere where i can see ALL parameters, which i can send to GCM? No matter, what language i use?
Cheers,
Chris
couple of things need to keep in mind while all the data which you sending from server end
Is there a list anywhere where i can see ALL parameters,
exp :- you can send as many parameters as you want but offcourse there is limitation but not key specific just like you can use "textmessage" instead of "message" but make sure to retrieve the value from same key which you are assigning from server end
1) please make sure that you are getting all the data in gcmintentservice class try to print the log of all intent data.
please remember that this is just a string data it is not going to download the image for you. you have to download using volley library or any suitable library

add followers to asana task using api

I just don't know why this fails. I have the following which attempts to add tasks to Asana:
$arrayOfIds = array("0123456789", "9876543210");
$followers = implode('", "', $arrayOfIds);
$newtask = $asana->createTask(array(
"workspace" => $workspaceId,
"name" => $name,
"team" => $teamId,
"assignee" => $assignee,
"due_on" => $dueOn,
"completed" => $completed,
"completed_at" => $completedAt,
//"followers" => array("0123456789")
"followers" => array($followers)
));
It works just fine when I put the user ID in manually, like above commented code, however fails when I try to use the array. I get the following error:
Error while trying to connect to Asana, response code: 400
Any help is greatly appreciated.
Without knowing exactly how the $asana lib is implemented (link?) my guess would be that the array is not encoded correctly. If sent via url-encoded post data (as opposed to JSON) the array should be comma-delimited. PHP may do something else like followers[]=1&followers[]=2 when it should be followers=1,2.
Try doing something like "followers" => implode(",", $arrayOfIds), or check the code of the library to see how it encodes arrays. Additionally, including the actual HTTP request/response would help figure out what's going in. There are many ways to get this - your library may include a verbose/debugging mode, but if all else fails you can always use something like Charles Proxy, Wireshark, Ettercap, etc.

Categories