vonage

Vonage: Set Webhook Address using API


I need to set the webhook address for receiving SMS dynamically in Vonage. I was previously able to do this with the Twilio and SignalWire APIs with something like this in Python:

client.incoming_phone_numbers.list(limit=1)[0].update(sms_url='...', sms_method='GET')

However, I have not been able to find anything in the official Vonage API Documentation about this.


Solution

  • You can set the callback for an individual number using our [Numbers API], specifically setting the moHttpUrl setting.

    For the current v3 version of our Python SDK, you should be able to use:

    numbers = client.numbers.get_account_numbers({"pattern": "<your number>", "search_pattern": 0}
    number = numbers.pop(0)
    number["moHttpUrl"] = <new webhook URL>
    client.numbers.update_number(number)