-
-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
820c2bb
commit c29c65e
Showing
6 changed files
with
239 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/Request/ConversationalComponentRequest/ConversationalComponentRequest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
namespace Netflie\WhatsAppCloudApi\Request\ConversationalComponentRequest; | ||
|
||
use Netflie\WhatsAppCloudApi\Request; | ||
|
||
final class ConversationalComponentRequest extends Request | ||
{ | ||
private string $fields; | ||
|
||
/** | ||
* @var string WhatsApp Number Id from messages will sent. | ||
*/ | ||
private string $from_phone_number_id; | ||
|
||
public function __construct(string $fields, string $access_token, string $from_phone_number_id, ?int $timeout = null) | ||
{ | ||
$this->fields = $fields; | ||
$this->from_phone_number_id = $from_phone_number_id; | ||
|
||
parent::__construct($access_token, $timeout); | ||
} | ||
|
||
/** | ||
* Return WhatsApp Number Id for this request. | ||
* | ||
* @return string | ||
*/ | ||
public function fromPhoneNumberId(): string | ||
{ | ||
return $this->from_phone_number_id; | ||
} | ||
|
||
/** | ||
* WhatsApp node path. | ||
* | ||
* @return string | ||
*/ | ||
public function nodePath(): string | ||
{ | ||
return $this->from_phone_number_id . '?fields=' . $this->fields; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/Request/ConversationalComponentRequest/UpdateConversationalComponentRequest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace Netflie\WhatsAppCloudApi\Request\ConversationalComponentRequest; | ||
|
||
use Netflie\WhatsAppCloudApi\Request; | ||
|
||
final class UpdateConversationalComponentRequest extends Request | ||
{ | ||
private string $from_phone_number_id; | ||
private array $components; | ||
|
||
public function __construct(array $components, string $access_token, string $from_phone_number_id, ?int $timeout = null) | ||
{ | ||
$this->from_phone_number_id = $from_phone_number_id; | ||
$this->components = $components; | ||
parent::__construct($access_token, $timeout); | ||
} | ||
|
||
public function body(): array | ||
{ | ||
return array_merge( | ||
[ | ||
'messaging_product' => 'whatsapp', | ||
], | ||
$this->components | ||
); | ||
} | ||
|
||
public function nodePath(): string | ||
{ | ||
return $this->from_phone_number_id . '/conversational_automation'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters