Open n-other opened 7 years ago
Thanks a lot for your PR and many people will appreciate the time you spent - let me give it a good look over when I have some time and then I'll get back to you :)
Hi, i tried to use this patch for sending direct message with quick replies. Unfortunately it only send a simple text message without quick replies. (Remark: it works fine for message with media, thanks!;o)) Here my code for the params:
$params = json_encode(array('event' => array('type' => 'message_create', 'message_create' => array('target' => array('recipient_id' => $userid), 'message_data' => array('text' => 'Test with quick replies'), 'quick_reply' => array('type' => 'options', 'options' => array(array('label' => 'A','description' => 'ADesc','metadata' => 'external_id_1'),array('label' => 'B','description' => 'BDesc','metadata' => 'external_id_2'),array('label' => 'C','description' => 'CDesc','metadata' => 'external_id_3')))))));
Thank you so much for help !
Sorry guys, I don’t have right now available time to check it, I guess quick reply messages require usage of different Twitter API.
On 18January, 2018 at 19:23:10 PM, Optisys67 (notifications@github.com) wrote:
Hi, i tried tu use this patch for sending direct message with quick replies. Unfortunately it only send a simple text message without quick replies. (Remark: it works fine for message with media, thanks!;o)) Here my code for the params:
$params = json_encode(array('event' => array('type' => 'message_create', 'message_create' => array('target' => array("recipient_id" => $userid), 'message_data' => array('text' => '', 'attachment' => array('type' => 'media', 'media' => array('id' => $id)))))));
Thank you so much for help !
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/J7mbo/twitter-api-php/pull/241#issuecomment-358644790, or mute the thread https://github.com/notifications/unsubscribe-auth/AK5dOx89-BW8s8SEkmBZ0C866DoskHWjks5tL0W8gaJpZM4OKc-2 .
Unfortunately this API was not usable when coming to the sending of direct messages with media attached.
This process requires 4 twitter api calls: 1) media init 2) media append (upload) 3) media finalize 4) direct message with media_id
It took me some time to develop this code snippet along with a patch expanding the code to allow this type of messages. Here it the code snippet: $settings = array( 'oauth_access_token' => env('TWITTER_ACCESS_TOKEN'), 'oauth_access_token_secret' => env('TWITTER_ACCESS_TOKEN_SECRET'), 'consumer_key' => env('TWITTER_CONSUMER_KEY'), 'consumer_secret' => env('TWITTER_CONSUMER_SECRET') );
zipped patch attached patch.zip