How to read webhook response in Dialogflow CX - google-cloud-platform

I have created a simple Agent in Dialogflow CX. When the user enters a city name then it should list pin codes that belong to the entered city. In order to get the pin codes, I have performed a webhook POST request. The webhook URL returns the required pin code in JSON format but I don't know how I should display it in the chat.
Can I get some tutorial links? OR What changes I need to add in the Agent inorder to read the JSON response.

Don't know if this will actually solve your problem, but I recently had a similar doubt to yours and this cleared it up for me.
From Google's Documentation for CX Webhooks, the response message for a webhook call is structured with a fulfillment_response field: this contains what the bot will say to the user if the webhook call is successful.
So, to answer your question what should happen is this:
The user enters a city name, e.g. Atlanta
The bot extracts the city name with a parameter and stores it, for example, as the $intent.params.city_name
The bot also has "Enable Webhook for this page" enabled, and thus makes a Webhook request in JSON with a field called IntentInfo which contains a parameters field
You call your API o do your computation or whatever in your script
You build a WebhookResponse compliant with their format which contains a fulfillment_response field with a list of all ZIP codes for Atlanta in a format like such: "Here we are, these are $intent.params.city_name's ZIP codes: [your computed zipcodes]". For reference, there is an API package for most programming languages which can help you with that.
The bot will receive the JSON and directly respond to the user with what is inside the fulfillment_response field
Hope this solved your doubts!

Related

How to add Customer Phone Number and Company to Authorize.net ARB Create Subscription API

I am using Authorize.net API Create Subscription API (ARB) using this API reference -
API Document
Everything is working fine.
Just I want to add phoneNumber and company in customer billing information. Its also given in API reference but I am unable to send in subscription object.
For checking code you can check in above share API Document the PHP Code.
Its really appreciate if someone help me out in this.
Within the ARBCreateSubscriptionRequest you can include company under billTo block, the request also can take an optional customer block, you may include phoneNumber under the customer block. For more detail visit the API reference and check the request field description section under the request in question. (Api Ref.: https://developer.authorize.net/api/reference/index.html#recurring-billing-create-a-subscription).
ARBCreateSubscriptionRequest billTo.company | customer.phoneNumber

Processing Answers to emails sent by the system

I'm building a ticketsystem which creates tickets from incoming email automatically. The workflow look's like this:
User send's a email to support#yourname.xyz
The System creates a new ticket
A Team member answers to the ticket via a Dashboard
The User get a notification with the answer per email
Now I wan't to give the user the option to answer the ticket by reply to the email from step 4. But how can I assing the reply to a ticket?
Sometimes I saw solutions where the ticket id is stored in the header. The subject looks then like [#12345] Your Request But is there a better way to store the ticket id so the user can't see it? When I set a header variable on the email sent in Step 4, the varibale won't be included in the reply from the user.
Dose anyone have a soulution for this problem?
instead of prefixing the ticket ID to the 'Subject' field, create a new field in your out-bound mail. Just as you create a 'SendTo' field, also create a 'TicketID' field. This makes the value hidden unless the recipient looks in the mail's headers.
this will then also make it easier to search for replies by the ticket number.
I think I've understood your question, but if not, please clarify.

Vtiger : How we have to manage Email thread on Lead Module?

We are sending email to customer from Lead module and email sent to customer successfully from Vtiger. also we have integrate Mail Manager
in Vtiger.
i can also see that email in Sent box.
now, When Customer will give reply for that mail which i have sent from Lead module that will automatically appear in Lead Module Email Tab. right now i am getting am reply in Mail Box but i need log email in Lead section with particular customer replay.
Please help me if anyone solution..
It's by default functionality which is provided by Vtiger CRM.
We have configure Mail Scanner and select folder which we have to scan.
also, we have add condition or rule for this what we have to do if we can get result while scanning.
Please check status for MailScanner in vtiger_cron_task table. it must be 1.
also we have to set vtigercron.php in cronjob.
you can also run vtigercron.php in console on server with below command
php vtigercron.php
After success full scan you can get below message
Please Let me know if you have any question.

How to edit an existing event using the Facebook Graph API

I've done extensive research on this, and am baffled. Similar questions on stackoverflow have been answered with, in in short: RTFM. Well, I've done that, and more, and I still can't find how to do this.
On the main FB Graph API page, documentation is given for authenticating, reading, publishing (creating), deleting Graph objects, but I don't see modifying anywhere.
The FB Graph API > User page gives description only of how to create and delete an event on behalf of an authenticated user. I've had no problem with these two actions.
The FB Graph API > Event tells you how to retrieve an existing event, as well as publish to the existing event, posts, links, feed, etc. Once again, no help with modifying.
I've tried (desperately) (':'s removed intentionally due to hyperlink limit):
Sending the same POST request as creating event, ie to https//graph.facebook.com/<user_id>/events, but with an extra 'id' parameter--the existing facebook event id. Facebook doesn't like that, gives me an 'id parameter already sent' error (I'm assuming the user's id).
POSTing to the event directly ie to https//graph.facebook.com/<fb_event_id>/ using the same auth_token as was used to create it. 'Post unsupported' error message.
The fields I send along with the POST are the same as those when creating the event-- 'name', 'location' etc.
If someone's been able to do this, one simple POST example would clear everything up for me.
Thanks!
UPDATE I started using the PHP SDK, but lack of examples disheartening. In hopes that this will save someone else frustration Here are doc examples augmented with an actual api call example:
"You can create an event for a user by issuing an HTTP POST request to
PROFILE_ID/events with the create_event permissions and the following
parameters."
$facebook->api('/'.$profile_id.'/events', 'POST', $params);
Normal enough ... but edit event docs (as of 12/7/12) are misleading:
"You can edit an event by issuing an HTTP POST to /EVENT_ID with the
create_event permission. "
$facebook->api('/events/'.$eventid, 'POST', $params);
Brian
I was able to update a page event by using a POST (not a PUT) directly to the event, using the account or page authentication token. It sounds exactly like what you did in 2 above.
curl -F 'access_token=...' \
-F 'name=A modified event name.' \
https://graph.facebook.com/event_id
I would suggest that you try just sending a modified name field. Also, because you have already created the event, you have the correct permissions. For those who don't know, you need the extended permissions of offline_access, create_event, manage_pages, etc.
It is frustrating, because at one time there was documentation on updates on the Facebook site, but now I can't find it.
Updating is the same as creating BUT, you can only update events created by your APP ID..

I dont understand request flows

Having read a bit, I still don't understand. Can you help me see where I am going wrong?
a view function sends out a request and gets a response
a httprequest contains info about a currently requested url.
httprequest objects have 2 attributes containing info submitted by
user. GET and POST
Use post when requesting sensitive information, use get when not.
Post data is generally submitted from an html Form.
OK then. If I want sensitive information from a user such as their name, dob etc, I put the requested info inside a form on the html side. On the server side I gather that info by using an object
request and its attribute POST. I then point it to the html input name I specifically want. Thus we have request.POST['Name'] this will return a string value which I give to a variable of my choosing. Thus name = request.POST['Name']. name on the server side will now hold the users entered name.
Before I continue, is there anything I have gotten wrong?
You're nearly right.
The distinction between GET and POST, however, isn't anything to do with sensitive information. It's true that GET data is visible in the URL (after the ?) and POST data isn't, but that doesn't make POST any more secure - it's trivial to get that data if you want to.
In fact the difference is really one of semantics. GET is used when you're just requesting particular information from the server - for instance, page 2 of a set, or a specific search query. POST is used when you're updating information - submitting a form to change stored data.
Apart from that, you're just about there. One thing that will probably help you is to read up on Django's forms framework, which does a lot of the work in generation and validation of forms for you.
You got one tiny bit of it wrong.
The user sends out a request, which the view function receives, then the view function sends out a response.
And HTTP objects have a lot more information included than just GET and POST variables. See Django's official documentation for more information about this.