This is an issue I have been facing with fixing this github issue- https://github.com/appwrite/appwrite/issues/6386 . My doubt is I am not able to find CM adapter information. Could anyone please guide me regarding this. I also wanted to know how can I test this after creating the adapter.
the requirements for picking up this issue was:
Experience with CM.
Have you read through their docs?
I've had some experience with PHP and was planning to learn to integrate CM along the way via solving this issue.
<?php
namespace Utopia\Messaging\Adapters\SMS;
use Utopia\Messaging\Adapters\SMS as SMSAdapter;
use Utopia\Messaging\Messages\SMS;
class CM extends SMSAdapter
{
/**
* @param string $apiKey CM API Key
*/
public function __construct(
private string $apiKey
) {
}
public function getName(): string
{
return 'CM';
}
public function getMaxMessagesPerRequest(): int
{
return 1;
}
/**
* {@inheritdoc}
*
* @throws \Exception
*/
protected function process(SMS $message): string
{
return $this->request(
method: 'POST',
url: 'https://api.cmtelecom.com/v1.0/message',
headers: [
'Content-Type: application/json',
'Authorization: Bearer ' . $this->apiKey,
],
body: json_encode([
'from' => $message->getFrom(),
'to' => $message->getTo()[0],
'body' => $message->getContent(),
]),
);
}
}
This is what I have come up with
Make sure to test it and add any reference material to the PR (or as comments in the code)
Could you please review this once
Linting failed. Please also add screenshots of successful tests
I haven't tested it actually. How can I pass the Linting tests?
We have the linting information in our contributing guide here
Okay thanks, I’ll look into it
Let us know if we can close this thread for now. You can always text again, if you have more doubts 🙂
Sure
[CLOSED] Implement support for CM in the Utopia PHP messaging library
Recommended threads
- Type 'Theme' does not satisfy the constr...
Type 'Theme' does not satisfy the constraint 'Row'. Type 'Theme' is missing the following properties from type 'Row': $id, $sequence, $tableId, $databaseId, a...
- Custom Domain TLS Error (perfinso.com)
Hey Appwrite team/community, I need urgent help with a custom domain setup! I've added perfinso.com to my project, pointed the nameservers, and verification is...
- User unable to delete document they crea...
I am having a bit a database issue. I am making a music review website and I have successfully been able to create and update reviews as a dummy user, but no ma...