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
- Query Appwrite
Hello, I have a question regarding Queries in Appwrite. If I have a string "YYYY-MM", how can I query the $createdAt column to match this filter?
- Different appwrite IDs are getting expos...
File_URL_FORMAT= https://cloud.appwrite.io/v1/storage/buckets/[BUCKET_ID]/files/[FILE_ID]/preview?project=[PROJECT_ID] I'm trying to access files in my web app...
- Invalid document structure: missing requ...
I just pick up my code that's working a week ago, and now I got this error: ``` code: 400, type: 'document_invalid_structure', response: { message: 'Inv...