Search code examples
phpvonage

How to pass html link to nexmo sms response


I want to pass html link in the nexmo sms response once the order is confirmed. but it is taking it as a text.

Here is the code :

$api_key = '********';
$api_secret = '***************';
$number = '*************';
$message = 'Your order has been placed.';
$message .= "<a href='accounts/download_order/'>Download your tickets</a>";
$url = 'https://rest.nexmo.com/sms/json?' . http_build_query([
                                        'api_key' => $api_key,
                                        'api_secret' => $api_secret,
                                        'to' => $number,
                                        'from' => 'NexmoWorks',
                                        'text' => $message
                                    ]); 

Solution

  • It is not possible to include this in an SMS, you can only include the full URL as plain text - How that URL is displayed will depend on the end-users phone/OS.

    Example below;

    $url = 'https://rest.nexmo.com/sms/json?';
    $url .= http_build_query([
        'api_key' => $api_key,
        'api_secret' => $api_secret,
        'to' => $number,
        'from' => 'NexmoWorks',
        'text' => $message
    ]); 
    

    <a> tags are not support in SMS