I have created an account and add Twilio sandbox number for WhatsApp. After following instructions (To begin testing, connect to your sandbox by sending a WhatsApp message from your device to +1 415 523 **** with code join doubt-pupil. ) I have received a file in my WhatsApp number.
Code (PHP - Laravel):
$sid = config('app.TWILIO_SID');
$token = config('app.TWILIO_AUTH_TOKEN');
$twilio = new Client($sid, $token);
$message = $twilio->messages ->create("whatsapp:+9199740*****",
array(
"body" => "AlQuran4Life_invoice_".$invoice->formonth."",
"mediaUrl" => ["PDFURL"],
"from" => "whatsapp:+1415523*****",
)
);
After that I have added balance on Twilio. Now I want to make it live to send invoice to WhatsApp number.
What credentials I need to update? Or which phone number do I need to update?
Related
I am trying to create a destination charge from my customer to one of the connected account.
\Stripe\Stripe::setApiKey(STRIPE_SECRET_KEY); //Origin Stripe Secret Key
try {
$connectd_account_id = 'acct_XXXXXXX';
$customer_id = 'cus_XXXXXXX'
// sharing my customer with connected account and creating a token.
$token = \Stripe\Token::create(
["customer" => $customer_id], //doctor stripe customer id
["stripe_account" => $connectd_account_id]); //Lab Stripe Account
// I am receiving response ** No such token: tok_xxxxxxx **
$charge = \Stripe\Charge::create(array(
"amount" => 10000,
"currency" => 'USD',
"source" => $token->id,
"application_fee_amount" => 2000,
"transfer_data" => [
"destination" => $connectd_account_id,
],
)
);
} catch (Exception $e) {
$error = $e->getMessage();
}
everytime I receive
No such token: tok_xxxxxxx
What's my mistake here I can't locate. Please help.
If you're creating a destination charge, the card token and customer and related objects should all be created on your platform account. Your platform account is the one interacting with the cardholder and processing the payment, there is then just a transfer of funds within Stripe to the destination account.
Your code appears to be attempting to clone saved card details from your platform to the destination account, which is not what you would do for a Destination charge(you'd only do this if you were using Direct charges where the payment is processed on the connected account and thus need to copy payment information there).
In short, you should omit the code for creating a token, and instead when creating the charge, pass something like "source" => $customer_id, to charge the customer details on your platform.
I am facing a problem when I try to send multiple images in a single MMS. Even their documentation is not clear.
I couldn't find an example online showing the same.
According to their documentation about MMS
Up to 10 images that together total no more than 5mb can be sent at one time.
MMS is also only available in the US and Canada.
You can pass the images by using an array like so.
URL method: (urls have to be publicly accessible)
<?php
// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once '/path/to/vendor/autoload.php';
use Twilio\Rest\Client;
// Find your Account Sid and Auth Token at twilio.com/console
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$twilio = new Client($sid, $token);
$mediaUrls = array("https://demo.twilio.com/owl.png", "url2", "url3", "url4");
$message = $twilio->messages
->create("+12316851234", // to
array(
"body" => "Hello there!",
"from" => "+15555555555",
"mediaUrl" => $mediaUrls
)
);
print($message->sid);
Documentation:
https://www.twilio.com/docs/sms/api/media-resource
https://www.twilio.com/docs/sms/send-messages?code-sample=code-send-an-mms-message&code-language=PHP&code-sdk-version=5.x
More information about this here https://www.twilio.com/docs/sms/tutorials/how-to-send-sms-messages-php
I use https://github.com/coinbase/coinbase-php with laravel to send Eth from my wallet to wallet on other service.
I use this method: $client->createAccountTransaction($account, $transaction);
In this way:
$transaction = Transaction::send([
'to' => new EthrereumAddress($destination_address),
'amount' => new Money($amount, $currency),
'description' => $description,
//'fee' => '0.0001' // only required for transactions under BTC0.0001
]);
$this->client->createAccountTransaction($account, $transaction);
But when I try to do this, I get this error:
The Coinbase API only accepts transactions to an account, email, or bitcoin address
Can someone tell me how to send eth or what is wrong ?
This was fixed in the latest 2.8.0 version.
https://github.com/coinbase/coinbase-php/releases/tag/2.8.0
You should use right $account for each cryptocurrency, but not just the $client->getPrimaryAccount();
For example:
$account = Account::reference('YOUR_ETH_ACCOUNT_ID');
I am trying to trigger the send of a smart transactional email in Campaign Monitor from my Wordpress app
require_once( get_stylesheet_directory() . '/createsend-php-master/csrest_transactional_smartemail.php' );
# Authenticate with your API key
$auth = array('api_key' => 'apikey');
# The unique identifier for this smart email
$smart_email_id = 'emailid';
# Create a new mailer and define your message
$wrap = new CS_REST_Transactional_SmartEmail($smart_email_id, $auth);
$message = array(
"To" => 'email#email.com',
"Data" => array(
'x-apple-data-detectors' => 'x-apple-data-detectorsTestValue',
'href^="tel"' => 'href^="tel"TestValue',
'href^="sms"' => 'href^="sms"TestValue',
'owa' => 'owaTestValue',
),
);
# Send the message and save the response
$result = $wrap->send($message);
I've got the correct API and Email ID, and I'm using my gmail account to test with but the email just isn't getting triggered. I'm a beginner coder and I reckon I've just missed something completely obvious!
Path to the campaign monitor php file is correct too.
The API documentation is here https://www.campaignmonitor.com/api/transactional/?_ga=1.180877863.1694927084.1483423346 - is there anything I've missed out. Help is much appreciated!
I am trying to create tickets on my Zendesk and that is working fine. However i do not want Zendesk to email the creator of the tickets (his or her email). Is this possible?
The idea is i have a contactForm widget on my site, i want the submits from this form to create tickets in my Zendesk.
Creating tickets is currently working using this code:
$zendesk = new zendesk(
$row->api_key,
$row->email_address,
$row->host_address,
$suffix = '.json',
$test = false
);
$arr = array(
"z_subject"=>"Offline Message",
"z_description"=> $r->contact_msg,
"z_recipient"=>$r->contact_email,
"z_name"=>$r->contact_name,
);
$create = json_encode(
array('ticket' => array(
'subject' => $arr['z_subject'],
'description' => $arr['z_description'],
'requester' => array('name' => $arr['z_name'],
'email' => $arr['z_requester']
))),
JSON_FORCE_OBJECT
);
$data = $zendesk->call("/tickets", $create, "POST");
Any ideas?
Totally possible! You need to add some conditions to the trigger "Notify requester of received request" in Zendesk - Trigger setting to prevent zendesk from sending email. For ex:
Ticket : Channel - Is Not - Webservice (API)
Ticket : Tags - Contains one of the following - "offline message"
You could use another API endpoint "Ticket Import" https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_import/
It's do not send notifications