Messaging Metadata
Messaging Metadata
The SDK must be initialized before using any of these methods. See Initialize the SDK for more details.
Conversation Fields
Set Conversation Fields
Allows values for conversation fields to be set in the SDK to add contextual data about the conversation.
Conversation fields must first be created as custom ticket fields and configured to allow their values to be set by end users in Admin Center. To use conversation fields, see Using Messaging Metadata with the Zendesk Web Widgets and SDKs.
The values stored are persisted, and will be applied to all conversations going forward. To remove conversation fields stored in the SDK, use the ClearConversationFields
API.
Note: Conversation fields are not immediately associated with a conversation when the API is called. Calling the API will store the conversation fields, but those fields will only be applied to a conversation when end users either start a new conversation or send a new message in an existing conversation.
System ticket fields, such as the Priority field, are not supported.
Parameters
Dictionary<string, object>
- string: id of the ticket field
- object: Value of the ticket field
Note: Supported types for object
are string, number and boolean.
Example
If your custom ticket field id is 10093547287955 and you want to set its value to 548832222, then you would call:
var fieldToAdd = new Dictionary<string, object>
{
{
"10093547287955", //id
548832222 // Value
}
};
ZendeskSdk.Instance.Messaging.SetConversationFieldsAsync(fieldToAdd);
Clear Conversation Fields
Allows you to clear the conversation fields from SDK storage when the client side context changes.
This removes all stored conversation fields from the SDK storage.
Note: This API does not affect conversation fields already applied to the conversation.
Example
ZendeskSdk.Instance.Messaging.ClearConversationFields();
Conversation Tags
Set Conversation Tags
Allows custom conversation tags to be set in the SDK to add contextual data about the conversation. To use conversation tags, refer to Using Messaging Metadata with the Zendesk Web Widgets and SDKs.
Note: Conversation tags are not immediately associated with a conversation when the API is called. It will only be applied to a conversation when end users either start a new conversation or send a new message in an existing conversation.
Parameters
List<string>
A list of strings
Example
var conversationTags = new List<string>() {"tag1","tag2","tag3"};
ZendeskSdk.Instance.Messaging.SetConversationTags(conversationTags);
Clear Conversation Tags
Allows you to clear conversation tags from SDK storage when the client side context changes.
This removes all stored conversation tags from the SDK storage.
Note: This API does not affect conversation tags already applied to the conversation.
Example
ZendeskSdk.Instance.Messaging.ClearConversationTags();