Can I trigger an API call? - zendesk

My boss tells me we're getting Zendesk. I have no experience with it. We want to have it notify our system, e.g. via a call to an API which our system could expose.
Can this be done? Would I instead have to poll the Zendesk API?

Push notifications in web-applications are also known as "Webhooks". Zendesk does have a Webhook API, documented here:
https://developer.zendesk.com/embeddables/docs/android/handle_push_notifications_wh
and
https://developer.zendesk.com/embeddables/docs/ios/handle_push_notifications_wh
(Ignore the iOS and Android references - it's platform agnostic)

You can set up a combination of a Trigger and and External HTTP Target that sends an HTTP request to your API.
It will basically works like this:
You configure the external target to direct requests to the url of your API.
You configure the trigger with:
some conditions to look for (such as a ticket being updated with a specific tag), and
an action to perform when the conditions are met. In this case the action will be to send an HTTP request (with a JSON body) to the external target mentioned above.
Then, when the trigger's conditions are met, the trigger will send an HTTP request to your API endpoint.
You can add dynamic data to the JSON body of the request, such as the ticket number, user data, etc.
This article also might be helpful:https://support.zendesk.com/hc/en-us/articles/204890268
Note: External Targets are not currently available on the "Essential" Zendesk product, only "Team", "Professional", and "Enterprise."

Related

How to distinguish each Slack app installation?

I'm using Slack Bolt JS api. Can successfully install apps into slack workspaces following the http://example.com/slack/install URL. I'm trying to integrate this into a SaaS. The question is how to distinguish Slack app installations and how to determine which Slack app installation belongs to which of the SaaS user? My guess is that some information should be injected during the OAuth flow, but now sure how to do that using Slack Bolt SDK.
const app = new App({
installerOptions: {
installPath: '/slack/install',
redirectUriPath: '/slack/oauth_redirect'
},
// token, etc
});
seems like you need to implement authentication with OAuth and your own installationStorage. Take a look this doc
The basic steps that you need to cover are:
You need to start you app with SLACK_CLIENT_ID, SLACK_SECRET_ID and SLACK_SIGNING_SECRET
Include your custom callbacks to handle app installation (installationStore option).
In the above example, you will need to replace database.set and database.get by your own database query, server API or something else. Here you can see a full example.
After this setup, slack will call your app from many different workspace and the correct token will be recovered thowth installationStore.fetchInstallation. This will happen before call the event or message handler.
PS: You should not include token in the initialization of the app. It will be set later.

Multiple webook endpoints for incoming messages

I'm using the following guide to handle incoming messages:
https://www.twilio.com/docs/sms/tutorials/how-to-receive-and-reply-node-js
I added the endpoint for my prod environment to the "A message comes in" webook, which is working when I test in prod, but I want to test incoming messages from my dev environment too. Is there a way to add a second endpoint for this twilio phone number's webhook, or will I need to add another twilio phone number?
You will need to add another Twilio number, since each Twilio number can only have one webhook for "A message comes in...".
You create your own Proxy routing logic, which intelligently delivers the webhook to specific URL/destination based on some criteria in your logic. Your proxy routing logic would then be the destination for the "A message comes in...". This proxy routing logic could be done using a Twilio Function as an example.

How do I call a number with Twilio Studio flow REST API execution

The purpose is simply to call a number (my number) and have a message start playing.
I have created a Studio Flow like so:
And published that flow.
I've also bought a phone number and it is activated for voice & messaging. I can receive a test voice call with code and using TwiML).
In the settings of my phone number I have the following:
Accept: Voice Calls
Configure with: .. Studio ..
A call comes in: Studio Flow (and selected the correct flow)
I then proceed to use Postman to try and trigger my Flow using a POST request with the following parameters:
And the following body parameters where the To number is my number which is verified in my trial account, and the from is the number i purchased in twilio:
After clicking on Send in postman I receive a 200 OK message, but I am not receiving a call on my phone. What step am I missing?
Twilio developer evangelist here.
The variable you are using as the number to dial out from Studio is {{contact.channel.address}} but the contact variable refers to "data about the current contact engaging with your flow, such as their phone number".
Since you have triggered the flow with a REST API call there is not a contact that is currently engaging with the flow, so this won't give you the number you want.
You are, however, sending in some parameters from your HTTP request from Postman, notably a To parameter. Your data that you send to the flow endpoint like this will be available under the trigger context variable.
So, you should update your widget to use {{trigger.To}} instead (and you probably don't need From, as that is the number associated with the flow, or Body).
Let me know how you get on with that.

Using Twilio to respond to an SMS with a http redirect to an external webapp

so, when i send a text message to twilio number, i want it to trigger a specific event in the webapp via http POST. For example, by making a http call to the webapp URL (http://webapp.com/triggerA) which it process to trigger an event A in the webapp.
Can I do this with twilio? If,so is there a sample piece of code which I can refer.
From what I understand from your question, I think you can do the following.
With Twilio, when you login into here
https://www.twilio.com/user/account/phone-numbers/incoming
You will find a list of your incoming numbers, I am assuming that you have already purchased a number. Once you click on a number in the list, you will find a page that where you can view and set various properties for the number you are looking at.
You will see a header called Messaging. Under that menu you will see a request Url.
you can set this to http://webapp.com/triggera as per your example. you can also choose whether you would like to use a http post or a http get request type.
the link below, will help you further for handling the data that Twilio passes your application.
https://www.twilio.com/docs/api/twiml/sms/twilio_request
Louis

not getting any response from Google Checkout after successfully payment

I am not getting any response by Google Checkout:
I have the sample code from http://code.google.com/p/google-checkout-php-sample-code/downloads/list .
I am using this code in cartdemo.php:
// Specify <edit-cart-url>
$cart->SetEditCartUrl("https://mydomain.com/checkout/demo/responsehandlerdemo.php");
// Specify "Return to xyz" link
$cart->SetContinueShoppingUrl("https://mydomain.com/checkout/demo/responsehandlerdemo.php");
And I am using following settings:
API callback URL (Level 2 integrations only) [?]
Specify a URL for Google to notify you of new orders and changes in order state. [?]
API callback URL:
Callback contents: http://mydomain.com/checkout/demo/responsehandlerdemo.php
**Notification Serial Number**
but not getting any response,after completation of payment.
I have also changed the settings with "Notification as XML" by using https.
actually the application require to integrate simple google checkout functionality.Which will have an checkout button and after successful payment the order history with payment detail will save in my database.
I don't know what is missing.
is there any way do implement it simply using 1-2 files not so bulky code?
thanks
The code you have above doesn't have anything to do with getting data from Google after completion of payment (Notification API).
The code you have above is for the Checkout API which is the flow that involves sending your shopping cart data to Google.
edit-cart-url is the url that is displayed to the customer on checkout if they want to go back to your site instead of placing the order/continuing with the checkout process.
continue-shopping-url is the link presented to the customer to go back to your web site after successful checkout.
You have to implement the Notification API (of which one option is serial number notification) to obtain data from Google. The url to your handler is set in your account (same place where you see the options you mention above).
If you want to see sample PHP code (I'm not a Php dev, am .Net) for a handler that implements serial number notification, see basicapiresponshandlerdemo.php

Resources