Unable to link user to Whatsapp channel - smooch

I've configured my Whatsapp number to work with Smooch Sandbox. I've created an App and an user with an Free Trial account. However, I can't link my user to the Whatsapp channel. I've sent a request to https://api.smooch.io/v1/apps/appId/appusers/appUserId/channels with the following JSON body:
{"type": "whatsapp", "confirmation": {"type": "immediate"}, "phoneNumber": ""}
It returns:
{
"error": {
"code": "bad_request",
"description": "Linking not supported for whatsapp sandbox integrations."
}
}
How do I config my App to work with Smooch Sandbox for WhatsApp? The REST api docs are not updated with any Whatsapp specifications.

Related

Redirecting to Bot from URL

I am working on a .Net core Bot application where I have created an adaptive card and when user clicks it would be redirected to a new URL. Once, redirected I want to add a functionality that after user posts in the URL, he should be redirected back to the BOT with the posted data. Can anyone guide me how to approach this. Below is the sample JSON we have created for redirecting user to URL.
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "TextBlock",
"text": "This card's action will open a URL"
}
],
"actions": [
{
"type": "Action.OpenUrl",
"title": "Action.OpenUrl",
"url": "https://adaptivecards.io"
}
]
}
if you are asking about a Teams bot then you should follow the pattern for a Bot Task Module
Bot message + Card
Activate Task module (aka pop-up window)
task module can display another Adaptive Card
or a HTML page
Task Module completes and sends back info to your bot using task/submit

401 when using client_credentials auth flow

Everything works great with Postman and authorization_code grant. But I am trying to connect to FHIR with client_credentials flow, meaning no UI.
I am calling the url https://login.microsoftonline.com/xxxxxxxx-c9a9-4be5-a9f7-xxxxxxxxxxxx/oauth2/v2.0/token with the parameters:
grant_type: client_credentials
client_id: [my fhir application ID]
scope: https://[myCompany].azurehealthcareapis.com/.default
client_secret: [mySecret]
With that, I get back a token
{
"token_type": "Bearer",
"expires_in": 3599,
"ext_expires_in": 3599,
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Im5PbzNaRHJPRFhFSzFqS1doWHNsSFJfS1hFZyIsImtpZCI6Im5PbzNaRHJPRFhFSzFqS1doWHNsSFJf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6OuR1RLv9QDol6WjAOKTB12q07iFFgDL0UTinWLY--3dn0raVyd7ZtT_yzLNRZ9iqX_XXXXX"
}
Now when I call the url https://[myCompany].azurehealthcareapis.com/Patient I get 401 response.
{
"resourceType": "OperationOutcome",
"id": "114e91311cbd11458e3d3284db6c9826",
"issue": [
{
"severity": "error",
"code": "login",
"diagnostics": "Authentication failed."
}
]
}
This is what I have for Api Permissions
On the Fhir service, select Access control (IAM) from the left menu (if you are using Azure RBAC).
From there, click on Role Assignments
Then search for your your App Registration
This allows your app to have permissions to the Fhir service outside of that of the logged in users.

Webhook event not received from Autodesk Forge API

I'm using the Autodesk Forge API to convert a range of models from various formats into SVF files, and trying to use the Webhooks API to listen for transformation complete events for jobs posted to the Model Derivative service.
I have successfully created the webhook, and verified its existence by calling the get Hooks API endpoint. Below is the basic response i receive.
{
"hookId": "<my-hook-id>",
"tenant": "<my tennant>",
"callbackUrl": "<ngrok url>",
"createdBy": "...",
"event": "extraction.finished",
"createdDate": "2020-11-05T05:48:39.016+0000",
"system": "derivative",
"creatorType": "Application",
"status": "active",
"scope": {
"workflow": "<my-workflow-key>"
},
"urn": "<webhook-urn>",
"__self__": "..."
}
At my ngrok endpoint I have a basic Node ExpressJS server running. The server is set to respond to all methods across my designated callback url. I have also verfied my callback url is valid and active through postman, with POST request being successfully received and returning a valid 2XX reponse.
I then post a translation job like below to the Model Derivative API, and the job successfully starts and processes the job. I can verify this by manually calling to check the status of a job through the Model Derivative API, however my webhook callback endpoint never receives any notification of transformation completion event.
{
"input": {
"urn": "<Input Urn>"
},
"output": {
"destination": {
"region": "us"
},
"formats": [
{
"type": "svf",
"views": ["3d"]
}
],
"misc": {
"wokflow": "<my-workflow-key>"
}
}
}
Is there anything obvious that I might be missing as to why the webhook event never seems to be triggered, or any other way that I could see if the webhook event was even attempted to be fired from Autodesks/Forges side?
There seems to be a typo in the job payload: wokflow should be workflow.
Note that you can also test incoming webhook requests using online tools such as https://webhook.site.

Google image search api. Bad request

I'm using Google CustomSearch API v1 for image search but I have a problem with my JSON request.
When I filled out the search.cse.list (here) I got the JSON request like this:
GET https://www.googleapis.com/customsearch/v1?q=test&cref=AIzaSyAreDhTh3IqaGPqC44t08sQF_qbSGzzA7Q&cx=010855067127206535986%3Aqdh_vhglb4u&fileType=jpg&filter=1&imgSize=medium&imgType=news&num=4&searchType=image&start=1&key={YOUR_API_KEY}
And the response of this request:
{
"kind": "customsearch#search",
"url": {
"type": "application/json",
"template": "https://www.googleapis.com/customsearch/v1?q={searchTerms}&num={count?}&start={startIndex?}&lr={language?}&safe={safe?}&cx={cx?}&cref={cref?}&sort={sort?}&filter={filter?}&gl={gl?}&cr={cr?}&googlehost={googleHost?}&c2coff={disableCnTwTranslation?}&hq={hq?}&hl={hl?}&siteSearch={siteSearch?}&siteSearchFilter={siteSearchFilter?}&exactTerms={exactTerms?}&excludeTerms={excludeTerms?}&linkSite={linkSite?}&orTerms={orTerms?}&relatedSite={relatedSite?}&dateRestrict={dateRestrict?}&lowRange={lowRange?}&highRange={highRange?}&searchType={searchType}&fileType={fileType?}&rights={rights?}&imgSize={imgSize?}&imgType={imgType?}&imgColorType={imgColorType?}&imgDominantColor={imgDominantColor?}&alt=json"
},
"queries": {
...
},
"context": {
...
},
"searchInformation": {
...
},
"items": [
{
"kind": "customsearch#result",
"title": "free student testing cartoons | Home > Clipart > Cartoons ...",
"htmlTitle": "free student <b>testing</b> cartoons | Home > Clipart > Cartoons <b>...</b>",
"link": "https://s-media-cache-ak0.pinimg.com/236x/30/0c/a5/300ca57d460ab787202e36bdf0364e57.jpg",
"displayLink": "www.pinterest.com",
"snippet": "free student testing cartoons",
"htmlSnippet": "free student <b>testing</b> cartoons",
"mime": "image/jpeg",
"image": {
"contextLink": "https://www.pinterest.com/pin/568157309212095926/",
"height": 213,
"width": 236,
"byteSize": 14426,
"thumbnailLink": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcQ-JefdKWd1WZkuesaq01zldYRW2JmYd_z0cW0SF9OEXFMVr6M8XZO4kg",
"thumbnailHeight": 98,
"thumbnailWidth": 109
}
},
But when I tried to use this request at the browser bar I got an error:
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "ipRefererBlocked",
"message": "There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed.",
"extendedHelp": "https://console.developers.google.com"
}
],
"code": 403,
"message": "There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed."
}
}
I guess that I should use Ajax call, but I dont know how can I do it, because I am beginner.
I also made an API Key, "cx" and have enabled CustomSearch API at my console.developer account.
So the question is: How can I get values from this JSON request and then operate with them if I even cant get values in my browser? I want to get an image-link from this request.
Sorry for my English.
The Google Image Search API was deprecated in 2011, and has finally, now, been switched off :( You'll have to find something else to use, sorry :(

how can i post data using Mozilla rest add-on using mailgun api

I'm using this Mozilla ADD-ON to post the data in mailgun API
RestClient
Content-Type:application/json
URL I'm using
https://api.mailgun.net/v2/sandbox42924.mailgun.org/messages
Json Data I'm posting
[
{
"from": "Kaushik <kaushik#gmail.com>"
},
{
"to": "Kaushik <kaushikfb1#gmail.com>"
},
{
"subject": "Hello This is test mail"
},
{
"text": "Testing some Mailgun !"
},
{
"html": "<html>Hello These <h2>contents belongs</h2> to html content</html>"
}
]
OR
{
"from": "Kaushik <kaushik#gmail.com>",
"to": "Kaushik <kaushikfb1#gmail.com>",
"subject": "Hello This is test mail",
"text": "Testing some Mailgun !",
"html": "<html>Hello These <h2>contents belongs</h2> to html content</html>"
}
In both cases what I'm getting is
{
"message": "'from' parameter is missing"
}
I want to know how i can post the data.
In documentation they have not describe this process.
I'm curious to know how it is working?
Here is the link for the documentation Click Here. They are using library for using in each language. If you know the library in detail you can help.
Finally I found the answer of this so for the sake of other user so they may find a help from this post in future I'm submitting the answer.
the url is this one.
https://api.mailgun.net/v2/yourdoamin.com/messages
username = api
password = {your key}
Now after that set your content type:application/x-www-form-urlencoded.
Now post the data. for formatting the data you can use this link Click Here
Demo data format
from%3D%27Excited%20User%20%3Cme%40yourdoamin.com%3E%27%20%5C%0A%20%20%20%20%20to%3Dbaz%40example.com%5C%0A%20%20%20%20%20to%3Dbar%40example.com%20%5C%0A%20%20%20%20subject%3D%27Hello%27%20%5C%0A%20%20%20%20text%3D%27Testing%20some%20Mailgun%20awesomness!%27