0
votes

How to send adaptive card json to Azure Bot Service api from external source?

[Added on 07/08/2020] enter image description here

Trying to send adaptive card json or content to api/notify to show custom messages ms teams.

Just trying to send the adaptive card from Azure Bot Service to MS Teams via channel created.Currently i have hard coded the details/links/text in source code (Azure Bot Services app). Would like to send the customized adaptive card each time by modifying the content of adaptive card.

Currently if i call the www.sampleAzurebotservices.com/api/notify the hardcoded data is getting displayed. Hope this gives a gud picture.

1
When you say bot service API, do you mean the Azure Bot Service or do you mean your specific bot's endpoint? Are you trying to send an Adaptive Card to your bot (very unusual) or are you trying to have your bot send an Adaptive Card to Teams (normal)? What have you tried so far? Please edit your question to give more information. - Kyle Delaney
Hey Nanda, could you give us here a litle bit more detail about what you're trying to do? You have an adaptive card and want to send it to the bot service to send it to teams? You don't have to use the bot service, its way more convinient but you can theoretically send your cards directly to teams if you want to. - Tim Cadenbach
You have an adaptive card and want to send it to the bot service to send it to teams? [Nanda] :Yes Any reference links would be helpful... - Nanda kumar
@Nandakumar - Can you give us an example of a message you're sending to www.sampleAzurebotservices.com/api/notify and the code that handles the message? (Since there are multiple people in this thread, you will need to @ mention me if you want me to see your reply.) - Kyle Delaney
@Nandakumar - Is Abhijit's answer acceptable? - Kyle Delaney

1 Answers

0
votes

@Nanda, Check this documentation for your reference on how to send message to bot. Documentation has text message, for adaptive card you can use below code snippet.

var reply = MessageFactory.Attachment(new Attachment { ContentType = AdaptiveCard.ContentType, Content = adaptiveCard }); //pass adaptive card to content
var result = await turnContext.SendActivityAsync(reply, cancellationToken);

Let me know if you face any issue.