From 2d72cdb2c5adbe6b3fbf40dac8e1c85a09f9426b Mon Sep 17 00:00:00 2001 From: Radu Topala Date: Wed, 14 Feb 2018 14:39:48 +0000 Subject: [PATCH] added suggested actions to activity --- src/Skype/Api/Conversation.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/Skype/Api/Conversation.php b/src/Skype/Api/Conversation.php index bcc7f87..afb6a59 100644 --- a/src/Skype/Api/Conversation.php +++ b/src/Skype/Api/Conversation.php @@ -8,16 +8,23 @@ class Conversation extends BaseApi implements ApiInterface * Sends an activity message * * @param string $target In format of 8: or 19: - * @param string $content The message + * @param string $text The message + * @param array $suggestedActions * @return \Psr\Http\Message\ResponseInterface */ - public function activity($target, $content) + public function activity($target, $text, $suggestedActions = []) { + $json = [ + 'type' => 'message/text', + 'text' => $text, + ]; + + if (!empty($suggestedActions)) { + $json['suggestedActions']['actions'] = $suggestedActions; + } + return $this->request('POST', '/v3/conversations/' . $target . '/activities', [ - 'json' => [ - "type" => "message/text", - "text" => $content - ] + 'json' => $json ]); } }