Search code examples
phpclickatell

Clickatell callback url to receive messages not working


I have a clickatell account and i am trying to receive messages in php using it. I understand that I need to setup a callback url on it and i have added that. In the callback url, i have added the following code snippet

<?php

$req = print_r($_REQUEST, true);
$req = wordwrap($req, 70, "\r\n");

error_log($req, 3, "test.log");
mail("<my-email-address>", "sms test", $req);

When i call the url directly, it is working as it should and sending me the mail as well as logging to the error log file. However, when i receive a text message in clickatell, nothing happens (no mail/log).

Am i missing something here? Any pointers are appreciated. Let me know if you need any additional details which would help to resolve/understand the problem.

Thanks


Solution

  • After talking to the customer support of Clickatell, i figured out that there are two places to add callback urls inside your clickatell account. The first one is under the API which i was adding and it wasn't working. The second, and correct place for my case, was under the mobile number settings. To be completely clear, if you check under the SB Subscriptions link in your account, you would see a mobile number and a settings link next to it. That is where you need to add the callback url.

    Thanks everyone for your responses.