I'm interested in updating a ServiceNow record via an ActionCard. Updates to records in ServiceNow only accept a PUT. Is there an action type of HttpPUT
in lieu of HttpPOST
? A POST is simply denied with
The remote endpoint returned an error (HTTP MethodNotAllowed). Please try again later.
Since I'm using Microsoft Teams, I must use the message card format, per their docs:
"However, if you are sending actionable messages via an Office 365 connector, or to a Microsoft Teams connector, you must continue to use the message card format
"
110 - "@type": ActionCard
111 name: Set Assignment Group
112 inputs:
113 - "@type": MultichoiceInput
114 id: list
115 title: Chose an assignment group
116 isMultiSelect: false
117 choices:
118 - display: IT Service Desk
119 value: 4546b6fg1r864z10wk42964pnh4bccpq
120 actions:
121 - "@type": HttpPOST
122 name: Save
123 target: https://servicenow_instance.service-now.com/api/now/table/incident/sys_id
124 headers:
125 - name: Authorization
126 value: Basic base64_encoded
127 body: "{'assignment_group': '{{list.value}}'}"
[Updating answer based on new info] Because this is just a backend call, with no UI, there's no way for the user to know if the call was successful, or even if it was made at all (i.e. they might push again to see). As a result, it really would be better if you handled the PUT internally somewhere. If you want a complex input/output, you could look at a Tab or Task window, but practically speaking, the best is probably just to have the button click go straight back to the Bot as an input, have the Bot make the call, and respond appropriately to the user.
What that means practically is having your card action change from an "Action.Http" to an Action.Submit. You'd want to have the Submit send a payload of some sort (like a "sys_id" or whatever you need for ServiceNow) on the button click, as the example shows (it's just sending "x" in the link). That way, you get the button click "invoke" so to speak, and the info you need to proceed, without need to maintain state specifically in your Bot.
The call will come through as a normal Turn to your Bot (like a normal message), but instead of having a "text" payload on the Activity, it will have a Value with a CommandId (basically an ID to identify the specific button) and whatever you send as the "data".
Your Bot can simply detect that this property is populated, call ServiceNow, and provide the user with an appropriate response like "ServiceNow Ticket Updated" or whatever.
Hope that helps
[Update] In the end this wasn't a Bot interaction at all - see the comments below for more info and solution