cmdotcom / text-sdk-php Goto Github PK
View Code? Open in Web Editor NEWPHP SDK to send messages with CM.com
Home Page: https://www.cm.com/communications-platform/
License: MIT License
PHP SDK to send messages with CM.com
Home Page: https://www.cm.com/communications-platform/
License: MIT License
This package has no versions and dev-master is not stable. Please release a tagged version to packagist to announce this package is stable enough for production use.
is there a php8.1 support planned yet?
I get those deprecate warnings:
PHP Deprecated: Return type of CMText\Message::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /apps/cm_messaging/src/CMText/Message.php on line 269
PHP Deprecated: Return type of CMText\MessageBody::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /apps/cm_messaging/src/CMText/MessageBody.php on line 90
PHP Deprecated: Return type of CMText\TextClientRequest::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /apps/cm_messaging/src/CMText/TextClientRequest.php on line 47
Thanks in advance.
$client = new TextClient("{{API_KEY}}"); $content = '你好'; $result = $client->SendMessage($content, 'Test', ['00852xxxxxxxx']);
Response:
TextClientResult {#592 ▼ -httpStatusCode: 200 -response: """ { "details": "Created 1 message(s)", "errorCode": 0, "messages": [ { "to": "00852xxxxxxxx", "status": "Accepted", "reference": null, "parts": 1, "messageDetails": null, "messageErrorCode": 0 } ] } """ +statusMessage: "Created 1 message(s)" +statusCode: 0 +details: array:1 [▼ 0 => {#594 ▼ +"to": "00852xxxxxxxx" +"status": "Accepted" +"reference": null +"parts": 1 +"messageDetails": null +"messageErrorCode": 0 } ] }
However, in Message log, it shows the message status is "Cancelled".
Since this sdk replaces https://github.com/CMTelecom/messaging-php it would be helpful for people to have a more like for like replacement.
In my implementations of the previous sdk I've used the guzzle and its middleware for a different amount of extensions. Two of the most basic ones are logging (using out of the box Guzzle middleware) and testability (replacing the Guzzle handler with a Guzzle mock handler)
Is there any plans to update the curl implementation with Guzzle or are you willing to accept an PR that does just that?
Instagram messaging required message tags to be added to the message-text rich-object.
I'd like to send the sms with japanese sender name.
But It's marked ??.
What is the solution in this case?
Thanks.
Hey guys i'm struggling to design a webhook using this sdk for whatsapp. may you kindly assist.
You now have a __set
method in the Message class. But now the phpstan
wil give an error as follows. Either please create a normal set method or set the constant MESSAGEPARTS_MAXIMUM
to 10 would be very much appreciated.
Access to private property CMText\Message::$maximumNumberOfMessageParts.
"statusMessage": "Created 1 message(s)",
"statusCode": 0,
"details": [
{
"to": "86132xxxxxxxx",
"status": "Accepted",
"reference": "4950fb39-bcfd-4ce1-b731-612ab9840e20",
"parts": 1,
"messageDetails": null,
"messageErrorCode": 0
}
]
But I didn't receive the text message
Line 89 in 4704b76
Line 114 in 4704b76
Channels::WhatsApp
should be Channels:: WHATSAPP
since the definition is:
text-sdk-php/src/CMText/Channels.php
Line 24 in 4704b76
Hi guys i need assistance. I have been trying to get to you but to no avail, is there an SDK for creating Whatsapp webhooks. If not, how do I go about doing that in PHP. I am behind time, i hope you assist me. Thank you in advance.
Sender name is larger then the allowed maximum length (16 digits for a phonenumber or 11 alphanumerical characters [a-zA-Z]). It is still tried to send the SMS.
The SDK-Client returns "Accepted" as result, although the status is "Cancelled" in Messaging Log (cm.com).
Would be great to use fallback if sender name is to long or deny sending sms and returns correct status.
Can you make the package Laravel compatible or at least create a wrapper library for Laravel
Now we're forced to use type AUTO because now the code is as follows:
**
* Class MessageBody
*
* @package CMText
*/
class MessageBody implements JsonSerializable
{
...
/**
* @var string
*/
private $type = MessageBodyTypes::AUTO;
...
There is no way to override this. Can you please create a setter so we can set the body type?
Hi, there is no v1.1.1 on packagist. Pls update
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.