Create a template with quick reply in gupshup - gupshup

I'm using the gupshup API for create templates and templates simples and with call to action works, the problem come when a try to create with quick replies. I send the data of this way:
"buttons": [
{
"type": "text",
"text": "Call"
}
],
data: The response of gupShup should of are this: Hello this a test. | [Call]
but is only:
data: The response of gupShup should of are this: Hello this a test.
My question is how is object for create a template whith quick replais in the gupShup API

you need to change the type inside the buttons object.
"buttons": [{"type":"QUICK_REPLY","text":"connect here"}],
There 3 are the different types of buttons: PHONE_NUMBER, URL and QUICK_REPLY
You can find the facebook documentation in here: https://developers.facebook.com/docs/whatsapp/business-management-api/message-templates#creating-message-templates
Good luck!

Related

How to patch the localPost except for summary using GMB API?

I would like to know how we can edit localPost except for summary.
I created the request like following.
URL: https://mybusiness.googleapis.com/v4/accounts/23432/locations/23423/localPosts/23432?updateMask=summary&updateMask=title
Request body
{
"summary": "AAAA",
"event": {
"title": "TEST TITLE"
}
}
However, I can only edit summary, not the other field.
I tried following requet URLs as well.
https://mybusiness.googleapis.com/v4/accounts/23432/locations/23423/localPosts/23432?updateMask=summary,title
https://mybusiness.googleapis.com/v4/accounts/23432/locations/23423/localPosts/23432?updateMask=title
But, GMB API response dose not give me any error.
So, it looks like fine.
Do have you have any idea for this?
Best regards,
Here's how you should chain your parameters:
?updateMask=summary,event.title

Twilio Taskrouter - How to add information to custom tasks?

I'm working with Twilio programmable video and I'd like to integrate it with TaskRouter.
Currently I can create custom tasks with a POST request to:
https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSID}/Tasks/
Yet regardless of what I put into the request body, the task shows up as "Anonymous Task, Reserved".
Is this an issue of formatting? I'd ideally like it to say something along the lines of "Incoming video request" with the customer name in the task-bar similar to how chat tasks look.
Here's the dummy data I tried passing in to no avail. I've tried a few different ways:
{
"attributes": {
"type": "video",
"contact": "+17777777777",
"customer-value": "gold",
"task-reason": "support",
"callSid": "CA42ed11...",
"name": "Joe",
"customer_name": "Joe"
}
"name": "Joe",
"customer_name": "Joe"
}
None of this data is passed through to the task. Any help would be appreciated.

Django REST Framework - List items with possible actions

I would like to extend the standard ListAPIView by adding allowed actions to each item so that the JSON returned on GET /books/ would approximately look as follows:
[
{
"ID": 1,
"name": "Animal Farm",
"author": "George Orwell",
"actions": [
"detail": {
"method": "GET"
"uri": "/books/1"
},
"remove": {
"method": "DELETE"
"uri": "/books/1"
}
...
]
},
...
]
By having such an "action list", I can easily tell the frontend which actions are currently allowed so it can e. g. include only buttons for those actions.
I went through the DRF docs and could not find a similar functionality. Shall I write it from scratch or is there a 3rd party plugin that could possibly help me? And when writing this from scratch, how would you design (=where to write the code of) such a feature?
DRF has support for that when you use the OPTIONS method, you can find more info here.
You could take a look into how this SimpleMetadata function creates the list of actions and either base yourself on it to write yours from scratch, or just find a way to call it to render the action list.
I'm not sure, if there is such plugin in DRF (maybe something for serializers?).
If writing from scratch, you should override your get() method ListAPIView (or list() method of mixins.ListModelMixin)

microsoft-graph message ID

I call my mailbox using REST calls to MSGraph:
GET https://graph.microsoft.com/v1.0/me/mailfolders/inbox/messages
As expected I receive a Json with my mails.
To play with a specific mail (move, delete,forward, ...) I saw that the API should be called like
POST me/messages/{id}/forward
I can't target the message if I provide the value of the id field that I get from the JSon. Where to find the correct {id} that I should use?
my result is like the example at https://developer.microsoft.com/en-us/graph/graph-explorer see id: field when calling GET my mails.
Thanks
The id from JSON is OK. what you missing is you have not set the post conent for move/forward.
If you use the forward API, you should set the post content like below:
{
"Comment": "FYI",
"ToRecipients": [
{
"EmailAddress": {
"Address": "XXX#XXX.onmicrosoft.com"
}
}
]
}
This is the worked forward url for me(you can implement the move/delete like this too):
https://graph.microsoft.com/v1.0/me/messages/AAMkAGNjZTcyZDJmLTkzMjYtNGQwNi05Y2UxLTc5NDk0NjEwNjJjMABGAAAAAAAUYpVLVYiKTINMO3MZR0H5BwB3NF3PTyl5QIQd59edwRO9AAAAAAEMAAB3NF3PTyl5QIQd59edwRO9AAApBI9fAAA=/forward
For information please see:
https://learn.microsoft.com/en-us/previous-versions/office/office-365-api/api/version-2.0/mail-rest-operations#ForwardDirectly

Creating Post with Dynamics CRM Web API

A Post entity (https://msdn.microsoft.com/en-us/library/mt607553.aspx) cannot be created using Dynamics CRM 2016 Online Web API.
This payload should create a post on POST /api/data/v8.1/posts
{
"text": "Test Single Post",
"source": 1,
"type": 7
}
(source 1 is an auto post, type 7 is a status post)
But it returns:
{
"error":
{
"code":"",
"message":"An unexpected error occurred.",
"innererror"
{
"message":"An unexpected error occurred..."
}
}
}
Submitting the same payload with only "text" fails too.
Notice that the Post entity does not have single-valued navigation properties (https://msdn.microsoft.com/en-us/library/mt607553.aspx#bkmk_SingleValuedNavigationProperties) that will allow me to set the related entity (contact, account, etc).
For example, Creating a Task entity (https://msdn.microsoft.com/en-us/library/mt607619.aspx) works fine on POST /api/data/v8.1/tasks
{
"subject": "Test Single Task",
"description": "Test One Description of Task",
"regardingobjectid_contact_task#odata.bind": "/contacts(<someguid>)",
"scheduledend": "2016-07-21T12:11:19.4875892Z"
}
It seems to me that Post should expose something like regardingobjectid_contact_post#odata.bind, but it does not.
For context, this is how to create a Post via the SOAP endpoint and the SDK:
var result = Client.getOrganizationService().Create(new Post
{
Text = post.text,
RegardingObjectId = new EntityReference(
entityName,
Guid.Parse(post.regarding_guid)
)
});
Does anyone have a working example of a Post created via the Web API? Is this an omission in the Dynamics CRM Web API?
It doesn't look like this is listed in the limitations: https://msdn.microsoft.com/en-us/library/mt628816.aspx
UPDATE
It appears that the postregarding entity is where the link should be created to contact/account. This can be demonstrated by querying:
/posts?$filter=postregardingid/regardingobjectid_contact/contactid eq <someguid>
However, a "deep insert" like so does not work:
{
"text":"sometext",
"postregardingid":
{
"regardingobjectid_contact#odata.bind":"/contacts(someguid)"
}
}
The response is
Cannot create child entities before parent entity.
Nowhere it's mentioned like Post (activity feed) cannot be created using webapi. In fact it's not listed as crm webapi limitation like you pointed out.
Also on comparison, _regardingobjectid_value lookup property of post is different from activitypointer. Single valued navigation property too.
Out of curiosity, My investigation moved towards the Partner - post_PostRegardings
Only thing making sense - postregarding is strictly internal use. This could be the reason for all such behavior. This is my theory per v8.2 today(Aug 12 2017)
Description: Represents which object an activity feed post is regarding. For internal use only.
Entity Set path:[organization URI]/api/data/v8.2/postregardings
Base Type: crmbaseentity EntityType
Display Name: Post Regarding
Primary Key: postregardingid
Ref: https://msdn.microsoft.com/en-us/library/mt608103.aspx
Update:
Looks like MS recommend the community to use Organization service to create a custom Post record. Web api is still broken. Read more
I was recently struggling with this issue with an Activity table made using powerapps. For those who are interested, here's my post request:
POST: https://<MY_DOMAIN>.crm.dynamics.com/api/data/v9.1/<TABLE_NAME>
{
"regardingobjectid_contact#odata.bind": "/contacts(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)",
"description": "data for this entity",
"subject": "more data"
}
I didn't do anything different from other peoples' answers. I'll give an update if this problem fails sporadically. But as it is right now, it looks like regardingobjectid may be working in version 9.1
using D365 Api v9.1
POST https://{domain}.crm4.dynamics.com/api/data/v9.1/posts
{
"regardingobjectid_contact#odata.bind":"/contacts(guid)",
"text": "This is a private message post",
"source": 1,
"type": 4
}
source :
Auto Post
Manual Post
ActionHub Post
type :
Check-in
Idea
News
Private Message
Question
Re-Post
Status

Resources