I am not sure where/how to set up a webhook in servicem8. I want to trigger an update when a Job status changes from Quote to Work Order.
I have read the documentation, but am not clear on the process.
Webhooks in ServiceM8 are only supported when using OAuth authentication using an access token, so you will need to register for a free developer account to get your OAuth Client Id and Secret. If you have not yet done so, follow the steps listed here:
http://developer.servicem8.com/docs/the-basics/public-applications/
Once you have OAuth authentication working, Subscribe to the 'Job' webhook to receive notifications when job data has changed. Do this by POSTing to https://api.servicem8.com/webhook_subscriptions
As mentioned on http://developer.servicem8.com/docs/platform-services/webhooks/ , the subscribe request should include:
object='job'
fields='status'
callback_url - Set this to the URL you wish to receive notifications
Once you subscribe to the webhook, you will immediately receive a request at your callback url to challenge you own this url. The request will contain URL parameters mode=subscribe, and a challenge value. To successfully confirm the challenge request you need to return a 200 result, with the body of the response set to the challenge code.
If you successfully confirm the challenge code request, you will start receiving notifications at your callback_url for any changes to job data within your ServiceM8 account. The notification you receive will contain JSON data similar to
{
"object": "job",
"entry": {
"changed_fields": ["status"],
"time": "2015-01-01 00:00:00",
"uuid": "de305d54-75b4-431b-adb2-eb6b9e546013"
},
"resource_url": "https://api.servicem8.com/api_1.0/job/de305d54-75b4-431b-adb2-eb6b9e546013.json"
}`
Related
For getting envelop status, I followed these steps
docusign developer account, under connect, I created a connect with webhook url.
In code , I have given eventNotification with webhook listener url with https:// address of my application.
I am getting response in connect logs. But I am not getting any response in my application webhook listner .why?
I have used Laravel code, with route
Route::post('webhook', [TestController::class, 'webhook']);
But I am not getting any response in function?why?
Ensure that your server (the "listener") has an https URL that is visible (callable) from the public internet. Best way to confirm this: implement a GET function at a URL such as https://your-server.com/hello. It should reply with "hello" when called. Then try entering that URL on your mobile phone.
Look at DocuSign's Connect error log to see what it says.
To assure yourself that DocuSign is sending notification messages, first use https://webhook.site to get a test webhook listener URL, and configure DocuSign to use it.
If you feel that the messages are being sent to your server but are not being received by your software, check your web server's logs. For example, if you're including documents in your notifications, the notifications will be very large and may exceed your web server's default configuration limits.
One issue which I have found, the response which is sent from Webhook to our own custom API, which will receive request from webhook does not match
For e.g.argument webhook sends json payload , so make sure you have same object which is supported by your api from docusign connect
// this is C# code
public async Task Post([FromBody] JObject envelopeData)
To test locally, you can use ngrock, which will create local server but you will be able to debug
You can try something as below. The same worked for me.
if (!Request.Body.CanSeek) { Request.EnableBuffering(); }
Request.Body.Position = 0;
var reader = new StreamReader(Request.Body, Encoding.UTF8);
var body = await reader.ReadToEndAsync().ConfigureAwait(false);
I was trying to capture webhook response when i am creating the task from inside podio dashboard but i can't receive any response in webhook.site
Used Postman, auth2.0 validation to create and validate the webhook
POST request for creation was
https://api.podio.com/hook/space/7026308/
Request body was
{
"url": "https://webhook.site/e664de7d-b571-42f0-8844-19723ae64caf",
"type": "task.create"
}
Response i get was
{
"hook_id": 17701094
}
Then In webhook.site i got this message
hook_id=17701094&code=51cf7340&type=hook.verify
Then i fire validate POST method from POSTMAN
My POST request was this
https://api.podio.com/hook/17701094/verify/validate
request body was
{
"code": "51cf7340"
}
Response was blank
Then i created a task inside from podio dashboard but i didn't receive any response in my webhook.site
Please provide solution for my problem
To verify a webhook, you need to call the /hook/{hook_id}/verify/validate API end-point with the hook_id and the code.
To do this, you need to be authenticated to the API, so you cannot just do a POST from Postman.
You should code for this in your webhook.site portal. If a POST request comes in with type=hook.verify, authenticate to the API and call /hook/{hook_id}/verify/validate.
For more, see the docs: https://developers.podio.com/doc/hooks/validate-hook-verification-215241
Incoming Slack Webhook URL looks like https://hooks.slack.com/services/aaaaa/bbbbb/ccccc -- What is aaaaa, bbbbb, ccccc.. Can you please let us know is it possible to find what is the Slack Channel name and workspace name based on this webhook
Based on the incoming webhook alone (as a string) it's not possible, apart from the team_id mentioned in the comment above.
From my experience with only incoming-webhooks enabled and publicly distributed apps that information is available only in response after user installs the app with the standard OAuth process. Keep in mind that reponse will change depending of the scope of your application but if you ask for incoming-webhook you will get channel together with url which is incoming-webhook url. You will also get team_name and team_id which is Workspace info. You can find detailed explanation at https://api.slack.com/messaging/webhooks#incoming_webhooks_programmatic and https://api.slack.com/authentication/oauth-v2.
And here is an example of OAuth response json.
{
"ok": true,
"access_token": "xoxp-XXXXXXXX-XXXXXXXX-XXXXX",
"scope": "identify,bot,commands,incoming-webhook,chat:write:bot",
"user_id": "XXXXXXXX",
"team_name": "Your Workspace Name",
"team_id": "XXXXXXXX",
"incoming_webhook": {
"channel": "#channel-it-will-post-to",
"channel_id": "C05002EAE",
"configuration_url": "https://workspacename.slack.com/services/BXXXXX",
"url": "https://hooks.slack.com/TXXXXX/BXXXXX/XXXXXXXXXX"
}
So in the nutshell, as far as I know, there is no way to get information from webhook alone, but one other option, which is not directly the answer to the question is to expand your application and include web api permissions and then there is nothing stopping you to request that information independently from incoming-webhook directly from the workspace.
In the test web chat in azure portal, I get the bot to speak back to me the conversation id by getting it from session.message.address.conversation.id.
I wish to then view activities for this conversation id using the method described here:
https://learn.microsoft.com/en-us/bot-framework/rest-api/bot-framework-rest-direct-line-3-0-send-activity
(POST https://directline.botframework.com/v3/directline/conversations/abc123/activities
)
However, I get the following error:
{
"error": {
"code": "BadArgument",
"message": "Unknown conversation"
}
}
I have also tried:
POST https://webchat.botframework.com/v3/directline/conversations/9323c31ab1ba42328edc9191621f9c9c/activities
Any help on how I can use direct line to post/view activities for a webchat?
Thanks!
Explain your issue
I cannot reproduce your issue with POST conversations. Actually, I can only reproduce your issue with following step:
generate directline token => leverage the response conversationId and token directly call Retrieve activities with HTTP GET with:
GET https://directline.botframework.com/v3/directline/conversations/abc123/activities
Authorization: Bearer token
The correct steps are:
generate token => POST to Start a conversation => GET to Retrieve activities with HTTP GET.
For your requirement
I don't think we can interrupt outside of the conversion, as the description of Generate a Direct Line token
To generate a Direct Line token that can be used to access a single conversation.
So the token you asked from anywhere else, cannot request the activities in webchat.
An work around
You can leverage BotFramework-WebChat to quickly build up a web site bot testing environment. And generate the token in your own server for the bot client authentication. Then you can use the generated token and conversationId for requesting all the activites between bot and this bot client web site outside of the box.
Currently we are in the process of developing one iPhone application that deals with google calendar. There was need of syncing calendar events to the server side. Everything works fine.
But for push notification , we are following this process
Whenever we post request to :
https://www.googleapis.com/calendar/v3/calendars/email#gmail.com/events/watch
with parameters
"id":Unique string ( channel id) ,
"type": "web_hook",
"address": "https://abc-api.herokuapp.com/user/notifications"
In the header , we are sending
Authorization : **Bearer 'Access_token'**
and content type : json
We already added domain as authorized domain in the google api console
Access_token is user's account access token .
We are getting "Unauthorized webhook call" error.
{
"error": {
"errors": [
{
"domain": "global",
"reason": "push.webhookUrlUnauthorized",
"message": "Unauthorized WebHook callback channel: https://abc-api.herokuapp.com/user/notifications"
}
],
"code": 401,
"message": "Unauthorized WebHook callback channel: https://abc-api.herokuapp.com/user/notifications"
}
}
Anyone here who can help us to solve the issue ?
You might want to check this post, providing solution like verifying if your domain have a valid (not self-signed) SSL license. Also in google-api-php-client GitHub, instead of setting https://example.com/google/push (resulted in Unauthorized WebHook callback channel) or https://www.example.com/google/push (allowed me to successfully open channel, and object has been returned, however webhook has not been fired) as address they tried https://www.example.com/google/push/index.php and worked.
One potential issue is if you're testing in Google's "try it" section of the documentation. It's not stated, but this particular request does not work there.
Otherwise, there are a few things that need to happen with the domain you are supplying in the address. First, you need to make sure its verified in the google developers console for the application you are hitting the api with. Additionally, you need to add the website property to your search console (even if its just an api) and verify ownership.
Also, once you get past the unauthorized address issue, you will get another error requiring a resourceId be supplied.