-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fatal error: Uncaught Error: Class "MessageBirdObjectsConversationContent" not found in F:\xampp\htdocs\habraacdb\api\index.php:7 Stack trace: #0 {main} thrown in F:\xampp\htdocs\habraacdb\api\index.php on line 7 #184
Comments
Hi @siyaadguul . Can you please provide some details and maybe a short code sample on how you're trying to do the call ? Thanks |
text = 'Hello!'; $message = new MessageBirdObjectsConversationMessage(); $message->content = $content; $message->to = '252615302173'; $message->type = 'text'; $message->channelId = 'chan_id'; try { $conversation = $MessageBird->conversations->start($message); var_dump($conversation); } catch (Exception $e) { echo sprintf("%s: %s", get_class($e), $e->getMessage()); } ?> |
i am trying like this |
Hey, you can check the examples folder for some code sample, but for starting a conversation it should be like: $messageBird = new \MessageBird\Client('YOUR_ACCESS_KEY'); // Set your own API access key here.
$content = new \MessageBird\Objects\Conversation\Content();
$content->text = 'Hello world';
$message = new \MessageBird\Objects\Conversation\Message();
$message->channelId = 'CHANNEL_ID';
$message->content = $content;
$message->to = 'RECIPIENT'; // Channel-specific, e.g. MSISDN for SMS.
$message->type = 'text';
try {
$conversation = $messageBird->conversations->start($message);
var_dump($conversation);
} catch (\Exception $e) {
echo sprintf("%s: %s", get_class($e), $e->getMessage());
} |
|
it's now working. |
If the SDK call didn't error out, it should get into MessageBird's system so I would recommend contacting MessageBird's support with details about channelId/ recipient so we don't expose sensitive information on public boards. |
when i try to initiate new conversation i am gets error(MessageBird\Exceptions\AuthenticateException: Got error response from the server: Recipient not authorised) |
@siyaadguul that is the authentication error in case you didn't send the correct |
Okey Thank you i fixed it // Set your own API access key here. // Use WhatsApp sandbox channel as normal. $content = new \MessageBird\Objects\Conversation\Content(); $message = new \MessageBird\Objects\Conversation\SendMessage(); try {
} catch (Exception $e) { |
i want to send a message to my every customer who reaches my website or did registred in my system |
If you don't need 2 way communication and you just want to notify your customers I'd recommend using the simpler send message functionality. When you say you want to send from another contact, are you doing a for/foreach for multiple contacts, or are you just calling this same endpoint a couple of times? $messageBird = new \MessageBird\Client('YOUR_ACCESS_KEY'); // Set your own API access key here.
$message = new \MessageBird\Objects\Message();
$message->originator = 'YourBrand';
$message->recipients = [31612345678];
$message->body = 'This is a test message.';
try {
$messageResult = $messageBird->messages->create($message);
var_dump($messageResult);
} catch (\MessageBird\Exceptions\AuthenticateException $e) {
// That means that your accessKey is unknown
echo 'wrong login';
} catch (\MessageBird\Exceptions\BalanceException $e) {
// That means that you are out of credits, so do something about it.
echo 'no balance';
} catch (\Exception $e) {
echo $e->getMessage();
} |
i want to send whatsapp messages to my customers not messages first. and i think this code is about sms |
I want customers whether I have spoken to them on whatsapp or not to get the message across |
Understood. I'll do a test run locally also and get back to you. There's no reason why another call shouldn't work for you. Thanks |
okey |
hi Sir, |
Closing this to due to inactivity. |
when i tried to send Whatsapp message from my php
The text was updated successfully, but these errors were encountered: