how to create create event URL for voice app? - vonage

I tried to create a voice app it demands:
Event URL
https://exampe.com
Answer URL
http://example.com
which domain do I need to use? Its matter which domain I use? they don't know my domain anyway.

The answer and event URLs are callback URLs (webhooks).
This means that when a voice call is created, and some events happens (such as ringing, user answered the call, user rejected the call, user not answering the call, etc.), the voice server will send a structured request to the callback URL you have provided.
From there, you can develop the logic the callback URL to decide what to do when those events happen, similar to the onClickListener on an Android App's button, if you are familiar with that.
The callback URL server should be hosted by you, implementing the exact same interface. You can refer to this page on what is expected.
https://developer.nexmo.com/voice/voice-api/webhook-reference
As for the domain name, you can use whichever you want, as long as it is pointing to the correct route on your backend server.

Related

How can I redirect instruction when Reservation status is accepted? twilio

I am using twilio flex, task router and twilio functions. I want to redirect the live call to the function I've created.
The Scenario is,
User calls the twilio number.
Agent picks up the call from twilio flex dashboard on computer.
When agent ends the call, only agent should disconnected, and call should redirect to the function I've created.
Thank you,
Twilio developer evangelist here.
This is not something I've done, but the first thing that comes to mind is to over-ride the button that ends the call on the agent side. Rather than having it just end the call, it could call out to a Function that redirects the caller to your function.
I don't have any more detail than that right now. I recommend you try something like this and ask a new question if you have specific questions about the code.

Saving and loading facebook instant game multiplayer data of the game

1) Is setting up webhook necessary to save json data of a context shared between players of context?
2) How to validate callback url for webhook on facebook developer console? My game is already live on facebook for single player. (No local testing)
3) Can I use my own personal https url to setup webhook?
No, you do not need to use the webhook to save context data. You can use XMLHttpRequest, fetch or a JavaScript SDK for a service like Playfab or Firebase to store data. In fact, we wouldn't even recommend you use a webhook for saving data because if the player turns off messages from your bot you will not receive any webhook callbacks.
You can validate a callback URL using the developer dashboard, including the "Show Recent Errors" button, which is really useful for spotting any issues. You can also get more information from the Webhooks item on the left nav.
You may need to clarify what you mean by "your own personal https url". As long as Facebook can hit your webhook URL, everything will work. You cannot, for example use a localhost URL.

How to implement logic based on external redirects?

I'm building a website for a client (real estate), and on the website are links to a different website (adverts for properties). My client routinely activates and deactivates these adverts when he rents out a certain property.
The hrefs on my links look something like this:
<a href="https://domain.xx/estate/idxx/des-crip-tion-xx-xx-x-xx/">. If the advert is indeed active, it just takes them to the advert. If it is not active, however, the website in question redirects the user to https://domain.xx/estate-for-rent/city/, effectively sending the users to my client's competition.
I wish to implement some logic where, before handing the users over to the other website, the server checks to see if it is redirected to https://domain.xx/estate-for-rent/city/, or some similar logic, and if so, uses preventDefault, or something, and notifies the user that the advert is not available instead of sending them to the other website.
I wonder if I can use the fact that only if the advert is active does the resulting url in the users browser window (after they've been directed to the other website) match the url in my href. Can i somehow get the server to try to access the url in my href, and have it see where it gets redirected, and then do something based on that? On the back-end, I'm running NodeJS with Express by the way, and if it matters, I'm relying heavily on EJS for templating. Thanks in advance for any help!
This sounds more like a problem you could solve on the client as opposed to the server. For example, at a high level here's how I would do it:
Handle the click event for each link (really simple to do a catch-all with jQuery)
Fire off a HEAD request via AJAX to the destination URL (this would be much more efficient than a GET but depends on the external service supporting this verb)
Use the status code to determine what to do next (e.g. 2xx allow redirect, 3xx pop a message and block)

Webhooks are not fired. API nexmo

I use the nexmo api to redirect all call to a virtual us number to a real number.
To implement i use this request :
https://developer.nexmo.com/api/developer/numbers#update-a-number
With params below:
moHttpUrl : an url (https) on my server which respond 200 OK
country : US
misdn : the us virtual number
voiceCallbackType : tel
voiceCallbackValue : the real forward
voiceStatusCallback : an url (https) on my server which respond 200 OK
(The data is well recorded, i can see it on nexmo backoffice)
Problem : when i call the us number with my phone, the redirection is ok. I stay on line 10 seconds and stop the call.
At the moment nexmo should call my voiceStatusCallback but do nothing.
Furthermore i have no idea on which informations are passing with the webhook.
Thx for your help.
It looks like your problem is related to https, the simple call forwarding is part of our deprecated voice API and as such that only supports SHA-1 certs on https, so I'm imagining this is your problem.
https://help.nexmo.com/hc/en-us/articles/115005461928
There are 2 options, either use http for your callback (not great I know) or take a look at our new Voice API which will give you a lot more control, if you want to do a simple call forward you would just need to host a JSON file on a URL somewhere that contains a connect action see https://developer.nexmo.com/api/voice/ncco#connect You will then get a whole bunch of call event webhooks such as when the call starts, is answered and ends.
Rgds
Sam
Nexmo Developer Advocate

Telegram different between getUpdates and Webhooks

id like to start using telegram bot, i already read the documentation, but still can't get my head, what's the difference between "getUpdates" and "webhooks"
source: telegram docs
can someone explain this in plain language
thanks in advance
The difference between "getupdates" and "webhook" is just like the difference between pull and push!
Using "getupdates" you don't even need to have a sever! You call telegram server prodically by providing bot's token and it will send you new updates if there is any. It means that your bot is always busy calling telegram even if there is just a single update per your 1000 requests!!
Using "webhook", you first notify telegram about your server ip and listening port and your public key. Then telegram will call your sever whenever there is any update.
At last and not the least If you want your bot to be faster you should use webhook.
Two method can get same content, but you can only use one of them at same time.
Webhook is dependent on HTTPS server, usually use in PHP.
If you haven't a web interface, better to choose getUpdates, which doesn't required HTTPS address to receive updates.

Resources