coderforlife
coderforlife

Reputation: 1527

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.

Upvotes: 0

Views: 68

Answers (2)

dragonmantank
dragonmantank

Reputation: 15456

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)

Upvotes: 1

coderforlife
coderforlife

Reputation: 1527

The README for the Python library actually has the answer:

client.sms.update_default_sms_webhook({
    'moCallBackUrl': 'new.url.vonage.com',      # Default inbound sms webhook url
    'drCallBackUrl': 'different.url.vonage.com' # Delivery receipt url
    }})

Upvotes: 0

Related Questions